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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 {5 e% w" G4 d; C
  1. [code]EDMA sample test application
    2 r0 g# ^6 x$ ^6 g. l
  2. /*
    ( ?# V* d9 I6 g1 k* w
  3. * edma_test.c
    5 z2 C- D- ?1 x  i7 N% s
  4. *
    * `1 P: S) ]7 L) }
  5. * brief  EDMA3 Test Application
    ' j* S6 N9 ^! M8 I7 Y
  6. *
    $ n1 g) f" j) I& Y3 T; X) n
  7. *   This file contains EDMA3 Test code.
    1 f. G: r" v9 L6 @- u+ A
  8. *
    3 D6 X8 M" N4 X! O1 R  u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  G4 [+ w8 H- F9 \" U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - B4 ^& y" |3 W; G* U
  11. *         TO CHANGE.) W2 F; H" ]$ R5 A- H$ b+ [( j7 l
  12. *# g3 U* O( |- o/ b3 y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% k% k) }, |+ F% S6 f/ T$ U! F' q( H8 @
  14. *
    # m* p1 x/ b/ u- n/ L0 O' i0 J/ F
  15. * This program is free software; you can redistribute it and/or, w* M! \' M) \3 V
  16. * modify it under the terms of the GNU General Public License as$ D9 ^# D: c5 J
  17. * published by the Free Software Foundation version 2.
    ) c% _8 c/ Y9 B5 }- k. c4 y
  18. ** T7 {# T4 ~8 M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " ]+ v$ A' o! R9 `/ b
  20. * kind, whether express or implied; without even the implied warranty
    & P' a& L% Z% \& g5 R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# D1 h3 r2 R0 q. Q2 l0 O
  22. * GNU General Public License for more details.
    4 [4 B' [( _. s- k8 \; i* l" n
  23. */
    & i: O$ H) ~8 j/ J. G$ s
  24. : p; k" x/ }+ I+ l( u( f8 u- Z
  25. #include <linux/module.h>9 {1 B+ N# x6 z3 {) C( U5 m
  26. #include <linux/init.h>' g# a, Q* g" k8 }# y
  27. #include <linux/errno.h>
      o  ~; u1 ?5 E. N  H
  28. #include <linux/types.h>
    9 v5 [/ {: w- D# M' h/ K
  29. #include <linux/interrupt.h>6 P, R$ `) S% k
  30. #include <asm/io.h>
    - R9 a+ x9 z+ k/ y9 _9 O$ X+ k
  31. #include <linux/moduleparam.h>1 m7 i/ T/ m- D! k3 E8 h  y
  32. #include <linux/sysctl.h>
    . E* a# x- V2 Z9 E% a, X& \
  33. #include <linux/mm.h>& R- j( Z6 t: u& c1 R& s
  34. #include <linux/dma-mapping.h>
    ) @( y) V: L/ g- Q

  35. : {  w6 h7 J: m1 ~& v6 s: {
  36. #include <mach/memory.h>$ a6 \& Y; N0 X# _. I# f, M5 o
  37. #include <mach/hardware.h>
    8 W# \6 H8 N1 ?) D$ J  Y/ `; K
  38. #include <mach/irqs.h>+ z/ x# C* Q* W8 Q
  39. #include <asm/hardware/edma.h>
    ( a' n4 {& ?9 E' b

  40.   O% c% `7 R$ E
  41. #undef EDMA3_DEBUG9 L3 C. `; i* H
  42. /*#define EDMA3_DEBUG*/  M0 s' u2 Z2 d3 u  V$ o# j
  43. . W0 C3 l, [4 v2 ~; D9 z1 t
  44. #ifdef EDMA3_DEBUG# ^3 Y0 L7 e* P: {* E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % E) B3 z& _7 g! |  M. C0 f2 T9 j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 a: h" P& z  {" w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! I' M$ L9 `% Y& l0 V
  48. #else( v- G3 ]" I4 x( u
  49. #define DMA_PRINTK( x... )
    " }$ p# |5 S7 c1 m
  50. #define DMA_FN_IN
    ) K, I: q9 ^4 X! l; R  K
  51. #define DMA_FN_OUT- d1 ^  M8 V. K: V6 X1 ]! P  u
  52. #endif4 A9 Z: n% q4 ?% h* k) W8 |* ]
  53. 6 W4 r$ D* d* b, u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( H/ Y9 r2 U2 g! Q9 F$ G/ c
  55. #define STATIC_SHIFT                33 W. o* p& }/ o5 h+ @7 W
  56. #define TCINTEN_SHIFT               20
    3 U" e( \  P9 K! b4 T
  57. #define ITCINTEN_SHIFT              219 h8 C& S) D6 E) L
  58. #define TCCHEN_SHIFT                22; V+ m. K0 C1 \" b! r
  59. #define ITCCHEN_SHIFT               23& B) h3 y7 g, ~2 K. k* {$ ]5 ?

  60. ! z. P7 m5 o% w8 z' b& f! L; H
  61. static volatile int irqraised1 = 0;
    . h( L* ?- Z" k0 s$ d0 G6 @
  62. static volatile int irqraised2 = 0;
    $ @3 p9 c3 b- r- f* W
  63.   i3 l) u# j. a" B  H) }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  G& M# Z6 `" D( I* _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) V% J6 F6 y0 u0 Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' R# e& a* G* P

  67. " o: K* x5 ]9 v3 \: l& T5 K( D" c( _
  68. dma_addr_t dmaphyssrc1 = 0;
    . R' U$ i  [1 x! g& h8 c- {6 p2 @
  69. dma_addr_t dmaphyssrc2 = 0;7 Y0 v% k, M9 v4 P
  70. dma_addr_t dmaphysdest1 = 0;
    7 N- R4 f- b! i' f4 c4 |. u
  71. dma_addr_t dmaphysdest2 = 0;% |* V. W( P+ I* ~% L* [. `/ ^

  72. 2 p, d" P# }. z0 ~9 w/ A# n, i
  73. char *dmabufsrc1 = NULL;5 d2 \; w( g! k2 r2 ]
  74. char *dmabufsrc2 = NULL;: ]8 {; D4 L/ u" g
  75. char *dmabufdest1 = NULL;
    $ P/ v' g. r7 n
  76. char *dmabufdest2 = NULL;
    : r  k6 B% b5 v' A) b/ D$ {

  77. 5 h( L; C4 N* G& Q
  78. static int acnt = 512;. |) H* P' `* T8 f) T7 T+ k& ^
  79. static int bcnt = 8;, L: y/ K! Q6 {7 ^2 r- k
  80. static int ccnt = 8;2 [( Q9 T3 @( g. Y' [: B
  81. % t/ n$ X* u4 A6 H3 }
  82. module_param(acnt, int, S_IRUGO);: h9 ]/ o" ^0 g) }+ M( {/ _" s
  83. module_param(bcnt, int, S_IRUGO);
    : G$ c6 Q5 S5 n
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 J/ p) N, E1 T" S5 f

4 ]! d* g2 G5 }% H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ ~7 C+ k/ ]# ^+ v, darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 l- I6 `3 F2 M% B; O& H& {* R     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' j7 V6 I" g+ J1 d6 H4 q" }
1 G8 r: Z" M2 E  A  r
4 X3 A& x; N& b; |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-23 01:22 , Processed in 0.042212 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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