OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 14197|回复: 0
打印 上一主题 下一主题

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 ^" q0 p+ E: Z: @: ?, z) q
  1. [code]EDMA sample test application
    2 b- G3 o: ^& b. c0 u
  2. /*
    ; x, j! S4 Q$ b
  3. * edma_test.c6 v9 F9 H; Y% H1 i6 {: h* q* Q8 n
  4. *, ?4 b4 l8 t: M) n, e0 x: W
  5. * brief  EDMA3 Test Application% \, q% {, d) Z* Q
  6. *. H' a9 a6 x: k* c4 B, l, k7 i- `
  7. *   This file contains EDMA3 Test code.
    * K/ n* q' s) \0 q
  8. *  [$ q9 c5 F' \1 o2 o6 P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 `& k/ n3 u( D: G) M! b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! J& `. Y7 S: d: e" ~% H
  11. *         TO CHANGE.5 D, q) }: T* A" ?$ w
  12. *
      m! k/ W+ @1 `/ ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 p7 ]& L6 g) d( c: P5 Y4 N
  14. *, J7 ~$ ~9 m+ P2 e" t
  15. * This program is free software; you can redistribute it and/or
    4 b+ P+ i, f2 b, S7 R. ?" ^: S
  16. * modify it under the terms of the GNU General Public License as
    ' z7 W4 O; O" R, L! x
  17. * published by the Free Software Foundation version 2.
    & r% n" Y, ?9 h" S. k2 O* Y
  18. *
    # P! k: |$ O) p8 E! J4 t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! o. L) `, e0 ^* V3 k# G; k
  20. * kind, whether express or implied; without even the implied warranty
    ' l* V: v# w+ E& h! z2 A1 L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  R( ?( W  N  Y2 c
  22. * GNU General Public License for more details.3 v+ X- e0 @5 b3 K* I4 ~
  23. */
    ' P. O9 v! h" ^( p, i7 E
  24. + n1 l! m: P- Q! G
  25. #include <linux/module.h>
    4 {7 l7 b6 Y* Q- V% X
  26. #include <linux/init.h>
    $ \, d" L; N7 o7 G" @2 p- s! j) G6 n
  27. #include <linux/errno.h>
    2 R1 g: U: W7 i- ^9 u6 b" z
  28. #include <linux/types.h>
    2 a3 ^0 p9 Z# B, q9 Y( q. n
  29. #include <linux/interrupt.h>
    3 p) q2 w: u: n( Z
  30. #include <asm/io.h>
    ' L4 S/ g, l+ n; j) d' o3 i, L
  31. #include <linux/moduleparam.h>
    1 i7 Q0 K9 g; y6 r5 m
  32. #include <linux/sysctl.h>  E, U  ^& B$ @# v
  33. #include <linux/mm.h>
    5 [0 H4 g2 n+ y0 j& b/ G/ F
  34. #include <linux/dma-mapping.h>' }  @/ r5 G4 v8 k8 g
  35. - M) {2 p' s1 O  g9 d' ^
  36. #include <mach/memory.h>2 Y, O' j; p; C6 v
  37. #include <mach/hardware.h>
    ! ~/ ?% G5 U" o6 k, B) Y$ Z9 f: H
  38. #include <mach/irqs.h>( M1 u$ m/ q- X% M5 @
  39. #include <asm/hardware/edma.h>; U5 W2 j% t3 t' q. r
  40. , L2 J) f: h; G0 Z- R& v% j
  41. #undef EDMA3_DEBUG
    * F1 K7 R/ p6 T& u* [( F4 J3 W
  42. /*#define EDMA3_DEBUG*/
    . \: N9 W' w7 e& x. ^4 c) }3 s

  43. 9 J7 R; K2 x+ S3 g& ~+ y& r
  44. #ifdef EDMA3_DEBUG; x0 V3 H& A& @( I+ B5 X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 O2 q0 }) ]; N' v9 h4 i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 U* f# A* t9 x, `$ |) W9 q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); K/ B; M/ I: T1 A! j- e3 h9 \
  48. #else
    , Z3 T$ {! Q+ w0 X- O+ ^* m
  49. #define DMA_PRINTK( x... )% s  i$ u, p0 s. I
  50. #define DMA_FN_IN
    3 |" T4 l+ M6 S+ S! y# c) r
  51. #define DMA_FN_OUT; Q. C5 N6 b: I4 [- Z' C2 l
  52. #endif0 Z" [% {, A- x$ H* t
  53. ' T. E4 s% T3 G: v7 Y! Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % g# G; L- N- b/ {* [1 e
  55. #define STATIC_SHIFT                3% J* k9 s" q, r+ c" g
  56. #define TCINTEN_SHIFT               20
    / z# a1 c& |  [; J, y
  57. #define ITCINTEN_SHIFT              21& G7 B7 {0 P2 A, f7 J8 T
  58. #define TCCHEN_SHIFT                22
    4 u+ D6 J" Z& L1 K5 @; a
  59. #define ITCCHEN_SHIFT               23
    0 x+ m7 X& j# C5 H2 g1 m  Z% ?

  60.   ]  y( Y" U  W1 }; [8 T, J
  61. static volatile int irqraised1 = 0;! t/ w6 n% u6 z9 F; p2 V
  62. static volatile int irqraised2 = 0;* }; m" h, M$ {- l$ Y# y& L, C
  63. # t7 X' n# h) I$ I$ T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) w) c* Q4 y3 N/ A% }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ v& Q. b; n  P( X7 `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: G/ U) ?  |3 ^9 A9 H( H0 h2 T

  67. # A# M3 p. }3 ?0 d  `
  68. dma_addr_t dmaphyssrc1 = 0;, }2 l4 J; [2 f5 x) R2 S
  69. dma_addr_t dmaphyssrc2 = 0;
    1 d+ B! ~, p. V
  70. dma_addr_t dmaphysdest1 = 0;
    " o- e4 P# `& n# T: j; W
  71. dma_addr_t dmaphysdest2 = 0;7 h; Y0 y5 y% Q! \8 X1 F4 v

  72. - \- _- Y* a8 h) m6 m) _
  73. char *dmabufsrc1 = NULL;
    $ H$ P$ {) {1 R1 m# v
  74. char *dmabufsrc2 = NULL;
    , g& ^1 x5 g6 ^: u* ^! W1 l( n
  75. char *dmabufdest1 = NULL;9 K/ s& r! p& `( q0 Q
  76. char *dmabufdest2 = NULL;5 R# M1 C/ o; t, t/ J

  77. . o3 A5 M$ o* P+ ~# E+ G! e! v
  78. static int acnt = 512;& g& X# T6 A' i: P$ f) X5 c
  79. static int bcnt = 8;4 C3 ^7 [6 x/ T6 [- j. X
  80. static int ccnt = 8;0 f! F- o  H% g3 B

  81. * b6 }  L; o/ R6 }* x/ W/ ?7 p
  82. module_param(acnt, int, S_IRUGO);# c0 }! C. T* F) @7 \# N3 z
  83. module_param(bcnt, int, S_IRUGO);
    - G$ J& h, v6 k1 O  L
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* M& p/ X2 {0 A% z8 N# @6 g- O) F; E1 w2 p0 W8 U
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' J5 m! g  Z6 A( a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, W$ O- ^; i) E7 ]% R2 p8 v     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ {  Z9 v! F- c
5 B7 Q8 `4 U$ o5 J0 }, U  P" r: d- U3 Y+ _+ X6 {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-10-9 18:00 , Processed in 0.042665 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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