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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  w* _: t1 o) T: Z
  1. [code]EDMA sample test application
    4 m, ?  r, s8 p* P( d9 O  p  n6 T
  2. /*# z! v8 r  _2 N; a- s
  3. * edma_test.c/ o, |: g& S- E2 J7 m6 [
  4. *6 z5 }6 M& \6 ]5 v& q
  5. * brief  EDMA3 Test Application! h2 Y& p0 r0 T& w
  6. *; G9 u9 E* l3 S" F
  7. *   This file contains EDMA3 Test code.
    3 i; n* X- _" n6 |8 f: i
  8. *; L5 |/ z- y9 [. [5 b7 p7 q( m3 k! N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 l  K, N7 `2 [+ B2 ^, r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " \" E% C4 A  H/ U! t* C5 o
  11. *         TO CHANGE.
    - Q+ ~/ j9 _( Z/ T, f
  12. *
    * x4 L+ g8 g& l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 p# B) T" m9 \# G* E
  14. *& k% S" K4 q5 ~' w9 j
  15. * This program is free software; you can redistribute it and/or, }( G; q  @! ~& s9 L
  16. * modify it under the terms of the GNU General Public License as
    6 r  B1 s. ~; V2 y- P; z4 R
  17. * published by the Free Software Foundation version 2.
    8 \7 l! [9 j( u. _1 ^
  18. *
    ( N% B/ ]* D  F$ V2 J- q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 X8 F2 X4 w1 c6 x; |3 S  x+ P0 ~' s
  20. * kind, whether express or implied; without even the implied warranty
    6 B% {4 F6 Q0 K1 N. L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; S) R8 z8 d$ G
  22. * GNU General Public License for more details.; q. B1 W" Y9 w" u/ c+ V/ w$ y# F- t
  23. */8 F" r3 Q% `1 G, E0 m! J6 M
  24. $ w* m- H, l1 V/ A$ P! Y1 j9 d$ R
  25. #include <linux/module.h>
    ' _- U% }1 `1 J& j9 }: T+ }
  26. #include <linux/init.h>
    * A- `8 }# k, R. w7 {: [' F" h6 l
  27. #include <linux/errno.h>
    + Z% ]4 S1 {5 L8 W+ |1 J0 [) w
  28. #include <linux/types.h>
    . S7 j# s, [& e. X2 v8 X( n. z
  29. #include <linux/interrupt.h># f# q% f' x- t9 A- r- Q
  30. #include <asm/io.h>/ {% A' z# x( {! T
  31. #include <linux/moduleparam.h>! t% s# D8 ~4 b6 s4 d3 Y9 C; e
  32. #include <linux/sysctl.h>
    & R4 T% }* \1 k; \! H( t
  33. #include <linux/mm.h>
    $ N; M1 ?1 u; R: j! ^9 Y3 F! [) @( n
  34. #include <linux/dma-mapping.h>: i( ]+ d8 |' L
  35. $ y3 v4 `( s  Z# O+ H9 H6 c0 L0 {! Z
  36. #include <mach/memory.h>
    . T( b5 t: G) n9 Z# O
  37. #include <mach/hardware.h>' T4 s7 P2 G# t7 v5 ^
  38. #include <mach/irqs.h>2 T. S, S; V1 T2 B1 W
  39. #include <asm/hardware/edma.h>/ s, @: q7 t- \
  40. % B! q2 P7 W+ i+ n2 S
  41. #undef EDMA3_DEBUG
    ) g, X1 l; B- e
  42. /*#define EDMA3_DEBUG*/* |0 K# k' c6 ]3 h6 \- @

  43. , v: A5 ~  K) l  A
  44. #ifdef EDMA3_DEBUG7 R( c- E  c2 R5 B, Y$ M% I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# I8 u( F# E) p+ a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# j3 D% |( ~! O  s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : b% z* `* M8 r  B+ _
  48. #else0 r* [/ k! k9 M$ ~
  49. #define DMA_PRINTK( x... ). {7 _& A/ h' F. R
  50. #define DMA_FN_IN
    ; c8 u8 X; Y: |3 S7 q) y' X
  51. #define DMA_FN_OUT% z% B7 y0 U( @  T  l
  52. #endif' p2 F% q( |" O! h6 W

  53. 2 [; `# w! _+ u: ~# ~4 Q' @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 d( c6 p5 M% r# ?$ }
  55. #define STATIC_SHIFT                37 I* ?, I, p; r1 p- O, O
  56. #define TCINTEN_SHIFT               20; @+ y% J( u/ M: m; V3 Q/ p
  57. #define ITCINTEN_SHIFT              216 c& k- L0 O* z& j& O! h0 @0 W7 w
  58. #define TCCHEN_SHIFT                22. t/ V2 C# W9 P
  59. #define ITCCHEN_SHIFT               23
    , q! P% J" W, L1 l" U* k6 G

  60. " E9 Y7 y+ E1 t# H% P
  61. static volatile int irqraised1 = 0;
    ! p" B$ a0 ~, G( S* v
  62. static volatile int irqraised2 = 0;( R9 k# B- m/ D2 Q2 y% X

  63. 7 b9 e! A, r- F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 e2 Q2 @! j) c; S1 y8 I7 v+ {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 [& P& g3 L3 ?3 h. ?. n6 d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 d3 B: ~9 w: U2 U# s. w( X

  67. " u# G" h+ m. a- M. {# Q, I
  68. dma_addr_t dmaphyssrc1 = 0;. D: S5 l. ^/ E4 P
  69. dma_addr_t dmaphyssrc2 = 0;
    3 I% R# T' \2 i( g  E* B- D  P& J
  70. dma_addr_t dmaphysdest1 = 0;4 a/ r$ j$ h. f: K
  71. dma_addr_t dmaphysdest2 = 0;
    & p( s, R* s" K5 ~
  72. " S4 x4 z  z( d" v# X& X! Y$ a5 ?% \
  73. char *dmabufsrc1 = NULL;
    ( _$ Z3 P: y3 W( {: Y
  74. char *dmabufsrc2 = NULL;6 b5 D" o. P# U+ o$ \" S, h7 N; x
  75. char *dmabufdest1 = NULL;$ J7 a  c* [6 ]: o4 h. y
  76. char *dmabufdest2 = NULL;6 F* r) j' ], b4 o% z) P1 I, }3 Y

  77. 3 L' v/ O7 `% {( X: ~7 J* K. Y
  78. static int acnt = 512;
    - S3 N+ I. B9 `- y5 E: G  H
  79. static int bcnt = 8;
    / j' E+ h' n$ C& [# G
  80. static int ccnt = 8;: R6 E5 C! U  W6 V5 D: b

  81. : ]# p* ?3 L3 b# X4 F
  82. module_param(acnt, int, S_IRUGO);7 n$ V& l0 @  K% B' R# V
  83. module_param(bcnt, int, S_IRUGO);0 ?( P+ f7 s: l' n$ N$ ~& r* v
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* [+ C4 A# o1 U, g" u  b' C

/ ?# [6 e9 E) A! G! V      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! |2 P0 K: P  x9 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 n' n% \  e9 F1 {0 H  Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; e: t. N  a& Z

# }- Z* s! ]6 l; g2 O' B2 e/ Y; R7 i) `# I" a- Z* @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-22 10:40 , Processed in 0.039344 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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