OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 5461|回复: 0

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
发表于 2018-1-30 11:01:43 | 显示全部楼层 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 j2 a' B* w( j3 g3 S0 D2 p
  1. [code]EDMA sample test application
    , g8 @" D3 `2 |" J/ L
  2. /*  Y! t/ A/ x  o
  3. * edma_test.c
    - r! ]' V$ Y" M* ^
  4. *
    5 V* u3 A7 b8 T8 K2 P$ N
  5. * brief  EDMA3 Test Application
    7 }" d7 k- Z2 K# `' Q9 {
  6. *
    0 Z6 y! P1 U7 M$ U& x% {/ s
  7. *   This file contains EDMA3 Test code.- N9 O2 t2 A; }: v- R* _7 @
  8. *, S% K* i) m  a. ^9 p' s, G. m* f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - [" S9 M- V/ t' A: b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! Z& k5 R6 T/ b: }: z/ y
  11. *         TO CHANGE.
    , d8 V0 f& |4 D: ]2 A* y
  12. *
      n8 B6 r+ O6 t( o, w) F. V! P# e* B* `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 m6 ~0 V& {( \9 [# ]% I4 P
  14. *
    " u; {" i! N. v
  15. * This program is free software; you can redistribute it and/or
    % `+ R3 O7 J- H- l; ]
  16. * modify it under the terms of the GNU General Public License as8 P, ^" Y2 W- ]. a6 c# Y
  17. * published by the Free Software Foundation version 2.( J5 n1 H& T; {" W/ y
  18. *
      i4 b  g! ~0 T2 J+ G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 x2 x: D) Z8 i; y' }/ x3 G
  20. * kind, whether express or implied; without even the implied warranty
    ( [" k3 S. k6 D5 r) I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 e1 f, p6 {4 w. f
  22. * GNU General Public License for more details.: T  _7 V* t, M3 h: g
  23. */* k% q. T3 n) y. }! E3 j7 z0 Y

  24. + y& i! x4 T* P, v, U0 L" j1 L
  25. #include <linux/module.h>) I+ f) R! Z: n. Y9 n/ P
  26. #include <linux/init.h>9 z4 Y# u5 Q* {0 k2 L; @: `1 p
  27. #include <linux/errno.h>! a0 z' P0 R7 Z& ?' {2 a
  28. #include <linux/types.h>
    4 G5 l5 c  J  h9 A
  29. #include <linux/interrupt.h>
    6 t9 D8 h7 M2 ~# s
  30. #include <asm/io.h>
    / G; J$ q+ x( C) A5 L
  31. #include <linux/moduleparam.h>/ a7 ^; y5 V$ v; u2 D7 p
  32. #include <linux/sysctl.h>
    5 H( m" l) M% @/ e! f& `1 }
  33. #include <linux/mm.h>
      k/ |: q6 o/ u
  34. #include <linux/dma-mapping.h>
    . i8 ~* ?2 t% R

  35. 3 ]& P" x/ Q* k& H
  36. #include <mach/memory.h>( H2 a' b+ Q0 t7 r* D: ?
  37. #include <mach/hardware.h>4 a7 K4 Y0 ^" ~7 ^- t
  38. #include <mach/irqs.h>
    $ H  n& I" @$ {' b4 a2 j$ U2 m7 S  l
  39. #include <asm/hardware/edma.h>
    # T$ W, f6 o/ d$ o

  40. / E1 S( M. [' W) I" u
  41. #undef EDMA3_DEBUG8 ]9 X; b" @* Y) k
  42. /*#define EDMA3_DEBUG*/% b1 }$ Z7 d: g; W, y* r/ P
  43. % Y7 }: q( D; |" M1 y9 M
  44. #ifdef EDMA3_DEBUG
    ( w4 S/ u5 ~8 E5 ]7 P% M7 B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 O9 Y$ i8 Z$ R( r" S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 X# F2 o4 y; r+ S' L  q) o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # n) u. y0 L; S: F* N
  48. #else, N3 V+ I$ \. a: I1 G4 F
  49. #define DMA_PRINTK( x... )
    2 C7 k, o: C8 [
  50. #define DMA_FN_IN# }/ J  G  V; E! u$ E9 @3 `
  51. #define DMA_FN_OUT% s& J0 N/ Y8 }) L( W) `; y7 R
  52. #endif
    7 q5 q% @& w( \/ y) v* \, C

  53. ! F0 _* ?4 E1 J2 F% Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 O9 a3 V' P6 T( Z0 n- ?
  55. #define STATIC_SHIFT                3
    3 c4 e+ P% M6 |. p* t: Q9 \$ o" U* y
  56. #define TCINTEN_SHIFT               20
    # i  h/ k# Z, h* _
  57. #define ITCINTEN_SHIFT              21
    * F2 Z6 N- Z! I' G1 n6 r
  58. #define TCCHEN_SHIFT                22
    ( B1 t( M" w3 @- Q0 L- D- b0 f
  59. #define ITCCHEN_SHIFT               23
    0 ?  f1 z1 }8 y( e$ H3 D
  60. 4 i- e& e+ g7 D! q$ B% s
  61. static volatile int irqraised1 = 0;
    2 `/ }7 X! v( X- e& @7 R6 B
  62. static volatile int irqraised2 = 0;0 @: ?; L2 S' \( b: c0 y
  63. ) L1 f) S6 w( E" Y- z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 m" w7 ?# v( x4 R/ A, U" J) u+ r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: W) T" Q+ s5 X) m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 V" T7 P7 M# Q5 v* M

  67. " R3 D% N2 p$ \2 N, h6 b
  68. dma_addr_t dmaphyssrc1 = 0;& ~: R$ t" `$ D8 a, ?
  69. dma_addr_t dmaphyssrc2 = 0;  O4 f; u1 h5 ]
  70. dma_addr_t dmaphysdest1 = 0;# w9 F5 T! e! D0 N- c! m
  71. dma_addr_t dmaphysdest2 = 0;! z% C- |. a) Z

  72. 3 l4 I4 ^0 m! T" `' f2 o5 J3 X
  73. char *dmabufsrc1 = NULL;
    " P7 m5 {: x, a
  74. char *dmabufsrc2 = NULL;
    - m' x/ ~; E$ M4 o- `% R+ M
  75. char *dmabufdest1 = NULL;7 }! ^+ G6 G; T- Q# i* F
  76. char *dmabufdest2 = NULL;
    8 `) b- b. e1 N; J- P

  77. 0 s/ T2 |8 M9 S# h7 A3 P+ W! e% N
  78. static int acnt = 512;# [: T) c) i' R2 p1 O# j3 H
  79. static int bcnt = 8;6 v8 ^/ n6 I( Y: {9 R: ]
  80. static int ccnt = 8;) v9 [' z$ ^9 [+ m/ ]. I" R

  81. ) D" g' ~, O$ e, F
  82. module_param(acnt, int, S_IRUGO);
    ! X! K& j9 `7 O: A! w; e! k
  83. module_param(bcnt, int, S_IRUGO);
    # s  W( L% y2 r, r8 w! ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. B1 x4 H3 Y! W: U! V( c. D/ }9 E$ k( `, v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% u$ h* x% L+ ~
arm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, F- g4 f: |8 S     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ q  a3 t) o' y" v9 E' {% W
* v2 s; X4 x) l/ m: ^/ a6 y% v4 ]1 _
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2024-3-29 04:39 , Processed in 0.035991 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表