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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 P9 k' ~7 ^( e# ^7 ~! E% t
  1. [code]EDMA sample test application
    : \# |6 r4 p$ Z
  2. /*2 i4 e) s4 V% p9 u- J( Q! J+ t3 N, t* W
  3. * edma_test.c$ t. Z- [+ g6 S) Z3 R4 t
  4. *
    7 L6 D8 ]1 ^8 r6 \" f
  5. * brief  EDMA3 Test Application
    ' {5 @1 c' ]8 T" I/ c$ V: l
  6. *  A: u) g0 ]& w" S6 M) r: O
  7. *   This file contains EDMA3 Test code.
    9 r% C/ L. F6 U; r6 @
  8. *
    7 g$ o4 F; P; H1 N! ]! M% f8 G. k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 ?  F  C. q3 [  E  r% J, }! [" W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 M4 @9 U$ i' a% n' Q! H' M( M
  11. *         TO CHANGE.
    * L) J. b$ ~9 R) O" v
  12. *$ ^, S- N! \: Q5 i+ n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( n) q( M) Q1 Z( n+ l& o/ y
  14. *
      P; a) y* i- b1 ?& u+ Z
  15. * This program is free software; you can redistribute it and/or
    7 ~2 V7 ?, [, |. |
  16. * modify it under the terms of the GNU General Public License as7 |3 z# e! {* L( {: `! D
  17. * published by the Free Software Foundation version 2.+ m9 X5 ~/ Z2 h" y; {  m; g
  18. *3 J/ _/ d) n, G' M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, z7 K% J, x: g8 g) M7 n8 u: b
  20. * kind, whether express or implied; without even the implied warranty
    ( s9 v; R: n: P" h1 e6 p, M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 f4 Y' V" P' W$ Z* H
  22. * GNU General Public License for more details.# s# O( T9 f8 P9 z5 r+ q- Z
  23. */
    7 l1 u( z# D& S# n0 v

  24. 3 o1 U# x" }  p8 s; ?
  25. #include <linux/module.h>. m+ _8 E. J! |1 {5 i& n
  26. #include <linux/init.h>
    / r  X* \- I" J! T' M( u
  27. #include <linux/errno.h>
    ) T& i0 L9 ^% k( E( Q6 W2 k' n
  28. #include <linux/types.h>: ?1 w! K$ M7 `; ?2 j4 {; L
  29. #include <linux/interrupt.h>
    0 a  J# Y8 j% Z- ~2 F
  30. #include <asm/io.h>
    ; N8 [# u4 i; C8 B( H& _7 y3 B
  31. #include <linux/moduleparam.h>
    - w/ d7 |' X; A9 |: x0 V2 I
  32. #include <linux/sysctl.h>
    - J  i3 J! @% N2 p5 t4 O# x
  33. #include <linux/mm.h>* h8 R6 e$ E5 A5 X8 M
  34. #include <linux/dma-mapping.h>. O$ m* E1 C& ^: z9 d9 ]4 U" K
  35. ; ]( N- r6 `  j2 p
  36. #include <mach/memory.h>
    6 K$ w8 i/ _+ ^* O! y  l
  37. #include <mach/hardware.h>
    ; l! K: O0 `$ O# z1 k% u
  38. #include <mach/irqs.h>0 O2 c6 u/ U9 S$ X
  39. #include <asm/hardware/edma.h>
    6 h: A) E) B8 s

  40. 0 P' T. o3 N# q, c' V0 e' @
  41. #undef EDMA3_DEBUG
    / Z3 A( Z; m' @! y7 [/ c# b( C, K
  42. /*#define EDMA3_DEBUG*/! N) D1 G2 D4 O9 y5 W" [" E

  43. % m5 ~) C3 W1 ?1 k$ q2 J- N. S
  44. #ifdef EDMA3_DEBUG: u/ l. p/ A0 U- H: ?1 K7 i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' h. [; q' p/ X; r1 K, b, N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& }; j) S$ H6 l* l9 O0 h  P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) G# L$ p1 F3 a( z7 E7 r
  48. #else+ Q; U0 g  `' r% V0 p0 w) P
  49. #define DMA_PRINTK( x... )
    1 e9 {8 g& [1 ^# y. J& |8 ~& t
  50. #define DMA_FN_IN
    ) s# K  H. ?5 V/ R  l
  51. #define DMA_FN_OUT
    : `5 b$ D! Z1 A' S0 \/ ?; i
  52. #endif/ M" R: h+ E+ p  W9 I
  53. ) ]+ j0 l$ ~& ?+ e9 K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). v, \9 N0 \, Q
  55. #define STATIC_SHIFT                3$ I% }4 q( H3 H+ A
  56. #define TCINTEN_SHIFT               20
    ( O$ F9 _5 ]- a. S4 _
  57. #define ITCINTEN_SHIFT              21
    * G& J# v- y" ^( o) G' t
  58. #define TCCHEN_SHIFT                22/ Y# n( ~  G% y: C3 B
  59. #define ITCCHEN_SHIFT               236 e3 m8 t! w- \& u$ u5 g- L' j

  60. & G$ G# _+ r, l
  61. static volatile int irqraised1 = 0;
    . j* T1 \; U, ], A, ~# ~
  62. static volatile int irqraised2 = 0;
    ; @( U% ?  y0 z+ l% a* u) ]

  63. * _# e+ Y( Q7 j2 g$ X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 t$ k( H7 F1 I- r: c+ @* b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. Q3 ^' W% N6 M8 c- K! e1 `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' Z( r2 O5 j; [) }' T, I4 w2 V

  67. 2 e7 M+ z' [# A4 o0 q+ A
  68. dma_addr_t dmaphyssrc1 = 0;
    $ U5 b0 O+ \* N+ W& m( E
  69. dma_addr_t dmaphyssrc2 = 0;
    8 O& d. `* b. V, r: Y
  70. dma_addr_t dmaphysdest1 = 0;
    1 C: Z( R- ?: s7 n3 f2 J0 N, p
  71. dma_addr_t dmaphysdest2 = 0;; o. y( e; b& @6 l' r: R
  72. " M# }: Y- x1 Q
  73. char *dmabufsrc1 = NULL;
    " D/ s2 {& J' H1 c
  74. char *dmabufsrc2 = NULL;
    # j/ Q, h1 @5 q: I7 n( }
  75. char *dmabufdest1 = NULL;
    $ F1 g: l7 D5 V5 R9 M  L8 p6 \8 K0 _
  76. char *dmabufdest2 = NULL;: j9 a+ ^+ A  c
  77. $ _/ Q8 L8 {. m# ^3 y
  78. static int acnt = 512;
    + S2 V% F  x7 ^, T6 H1 O
  79. static int bcnt = 8;7 i/ v6 n. _6 |# K# P+ M
  80. static int ccnt = 8;
    / E! a8 y% n" w( j
  81. 9 L$ z" U4 k( e$ C8 H
  82. module_param(acnt, int, S_IRUGO);/ h' W) j) ?" l: n% v- f8 j5 ~+ Q
  83. module_param(bcnt, int, S_IRUGO);
    ' `- H5 L" e/ p9 H- K6 f: _0 A' b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ ?' r9 p; l1 k: y
% ]# Z, t" t+ j8 |
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% x6 I" h# ^7 m7 j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# R+ H* N/ T6 j  A0 U* \/ }, N5 F6 B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 C$ @1 J& h, F+ b0 w1 \
$ A. V+ s3 y& `" o# V+ e/ R' X6 q
& x# t- S3 m2 D3 |  R8 t! g! s) |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-12 00:30 , Processed in 0.039639 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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