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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . v* }, Y; w3 F4 K  U% B* X
  1. [code]EDMA sample test application" C" t, e  |9 G6 K
  2. /*
    ! ^+ Q7 n' s3 \6 ~0 ]
  3. * edma_test.c+ {0 f  T5 ?: t, e
  4. *8 \* O$ Y/ H4 Q4 k& E5 e. y$ e/ o
  5. * brief  EDMA3 Test Application
    $ J0 i2 u# ~$ Q) E/ H9 l
  6. *
    ) u/ T( y# u+ F, [9 I; h1 Q
  7. *   This file contains EDMA3 Test code.
    & ^4 G' w2 @9 F- }3 {
  8. *: m4 p+ X% L! k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . v/ O% R% k1 b' j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 D4 W' s7 p9 o5 r7 P
  11. *         TO CHANGE.. A3 |! U0 T9 s, Z2 x
  12. *+ L" A0 e! Z( W9 G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( f6 f4 H% b2 U& g
  14. *
    , L% D/ a' d9 ?/ u8 w( `$ z9 [1 |
  15. * This program is free software; you can redistribute it and/or3 K! ]9 Z5 K) I$ [2 o
  16. * modify it under the terms of the GNU General Public License as* ?+ P" F  l- s7 T. f) X
  17. * published by the Free Software Foundation version 2.' U( w/ v; B( {! r/ @3 f( y
  18. *" h/ J# x/ {! e4 U" S; f: z- O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + ^/ a2 e. f# l
  20. * kind, whether express or implied; without even the implied warranty0 K: ?: K$ ?: w% e( T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! m0 T3 G& X' c& z7 E" |: x% c
  22. * GNU General Public License for more details.
    , ^; B1 c5 d( E2 w! n
  23. */% H. u1 F' e+ y* p% o

  24. 6 @5 H( c, h& |  T! j; c0 Z9 T) ?
  25. #include <linux/module.h>
    2 }2 W4 o8 a: {. k; {2 T
  26. #include <linux/init.h>
    3 Q7 X& V0 _; O
  27. #include <linux/errno.h>) _9 t, q" t0 K" C* x3 Q6 X
  28. #include <linux/types.h>
    $ |" L' M/ k7 q# E, w
  29. #include <linux/interrupt.h>4 o# }7 D! [  j. g# `+ w# H0 h5 d
  30. #include <asm/io.h>
    / N1 I4 I3 b+ H1 {, h
  31. #include <linux/moduleparam.h>- f: ~5 Q$ c" _2 N8 I4 e7 }# x( Z) s
  32. #include <linux/sysctl.h>& S) W! s; L3 F
  33. #include <linux/mm.h>' B+ R# G0 S8 V
  34. #include <linux/dma-mapping.h>
    , O* e) }6 o1 E6 Q

  35. & w5 K1 P+ D3 K# L
  36. #include <mach/memory.h>; p4 u/ X6 u! {1 c. f# m! G: z
  37. #include <mach/hardware.h>
    - U# y+ G* E. e! ^: ^9 }1 A, i2 {
  38. #include <mach/irqs.h>
    4 i6 j& G; M$ L2 o2 E5 Y
  39. #include <asm/hardware/edma.h>4 N: l8 p: e; M: ]$ B3 d
  40. % v) u  M* U8 O' s# j
  41. #undef EDMA3_DEBUG9 S, d" Q. l% f- i: p6 L6 Y5 X
  42. /*#define EDMA3_DEBUG*/
    ( x( u' U, R1 @! |. f4 Q; L
  43. 5 a" u, D8 B- ~  o% r
  44. #ifdef EDMA3_DEBUG
    $ H. z2 F3 m' {4 [1 ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! _8 p3 ]7 f  h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ `' E6 V5 ~0 F3 E+ X$ U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' w0 M! p, X% l* Z( k
  48. #else9 z/ v8 e1 y* L3 X$ U
  49. #define DMA_PRINTK( x... )
    9 c1 L' v% {2 u. t% Y7 }+ }
  50. #define DMA_FN_IN- ~  c/ Y0 d/ @8 U4 _( Y# o* Q
  51. #define DMA_FN_OUT
    9 A$ X9 z. M6 X4 }6 D
  52. #endif# N) g: ^* e( X8 h
  53. ( C, T) v) F  J% G0 n4 M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 i" [/ i4 P8 }7 x& |( j! c8 P2 f
  55. #define STATIC_SHIFT                3
    : a' V. g' X& Y( ~# B" d) t
  56. #define TCINTEN_SHIFT               20
    3 M1 w6 `* U' y3 G
  57. #define ITCINTEN_SHIFT              21
    1 X  ?4 f8 k# o/ [3 c( v
  58. #define TCCHEN_SHIFT                22/ F2 O2 T2 A3 l! A
  59. #define ITCCHEN_SHIFT               23
    7 h, ?( y3 P; q# l# F; h% R5 k

  60. 6 L/ f7 O' P5 A' ]$ v% m' i1 G
  61. static volatile int irqraised1 = 0;
    4 O' {! H- ]1 y1 p3 T3 w8 ]
  62. static volatile int irqraised2 = 0;
    % _2 c- m  W; g. |0 y5 |  c9 {

  63. ! z; P: k9 H& J2 b  M$ i5 X3 L& x9 v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  F+ I- E7 O5 w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & `% N" H1 U/ `' \) f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 b$ {) [$ ^# a$ _4 i; X
  67. ; Q7 C, w( }# a4 e) h
  68. dma_addr_t dmaphyssrc1 = 0;# o! P* E+ ^2 N- e  }# T% g
  69. dma_addr_t dmaphyssrc2 = 0;
    & `- j% Z) G, a0 h" n) X7 O
  70. dma_addr_t dmaphysdest1 = 0;: V+ U6 B5 f) Z  f
  71. dma_addr_t dmaphysdest2 = 0;' x; K' F3 ]5 A) r0 V( `2 r- `

  72. ) t7 ~" j1 W" w# m& G4 w  m. c
  73. char *dmabufsrc1 = NULL;
    : l/ D) o9 E% r2 W7 Z
  74. char *dmabufsrc2 = NULL;
    5 v  k& ^' A& v% ]: e, N9 B4 z
  75. char *dmabufdest1 = NULL;
    * o6 U0 }0 d; ~5 h& X
  76. char *dmabufdest2 = NULL;
    , l1 {" M9 T2 _* }, p) A1 A

  77. " R0 Z) T0 w5 ?3 j
  78. static int acnt = 512;2 X' ]: U! M& S" n9 q
  79. static int bcnt = 8;
    $ a8 y! ^: h4 q: l
  80. static int ccnt = 8;
    * i9 n9 U  C8 D. |5 |9 [

  81. ( \1 R/ P( |' [# l" Z
  82. module_param(acnt, int, S_IRUGO);
    9 t' w, T1 R8 Q" B' E: t: t
  83. module_param(bcnt, int, S_IRUGO);5 j) {# M3 w; M+ {  c) A- m: A) F. g. B
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 x$ U2 g6 }. w7 a% A

3 _/ T1 q5 d# e      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ e& ^$ F* i/ G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 T7 g* ?: g) ]0 B) x) L! E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# g! w( q/ C8 G$ e. K' v$ g3 ^, S+ o8 \4 a' q* _7 R; j
9 m( U' N0 O- _2 H5 T# C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-18 10:04 , Processed in 0.039064 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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