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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 q$ z  D! y2 Q& C. K
  1. [code]EDMA sample test application  E7 [7 G  C, e# S( C8 V' q" w2 R
  2. /*+ O& ^: V3 r' X$ ]' q+ _. M. k
  3. * edma_test.c7 T1 ~' Q4 S) i4 M. d
  4. *9 M1 F# f* ~: L; g0 C3 o' F6 [# V1 }
  5. * brief  EDMA3 Test Application5 Q5 a8 M! J$ z" u8 _& ?8 f  R4 m
  6. *
      I0 J$ C3 I& b: I  d/ X
  7. *   This file contains EDMA3 Test code.+ R2 s! U+ Z8 W8 }: L/ |  e* X
  8. *
    2 a3 z8 U4 |# n, k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 \" o& E' f+ Z5 N0 l7 X& R: ^& h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 N1 ]" J9 J1 F" Z" O8 ~) E9 K! _
  11. *         TO CHANGE.
    2 m2 ]2 r; ?+ \
  12. *2 w# G- R& {2 t- z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( x5 w# Z5 R6 W% z5 v( q
  14. *
    6 u& }3 s0 D5 k7 ?! b  i' s
  15. * This program is free software; you can redistribute it and/or# x0 @. R# e2 n  t" h
  16. * modify it under the terms of the GNU General Public License as. o1 s  e. {4 Z8 M
  17. * published by the Free Software Foundation version 2.
    $ J* E8 u4 d9 r! a
  18. *0 a- R0 [( b, I2 F( K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" _; t; W9 T6 M) h+ o  q# @; t% A
  20. * kind, whether express or implied; without even the implied warranty% D. @; E8 d7 @) T' h' x: g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: _# `* d/ I1 }6 {( S9 K  P
  22. * GNU General Public License for more details.# j5 E+ p! t$ c. r( n" T( V# ^
  23. */: W6 `8 k1 v% [5 P* s

  24. 1 ^! n8 P0 ^+ h) d2 D
  25. #include <linux/module.h>2 d1 M" z/ Z( p2 C: n! Z
  26. #include <linux/init.h>
    9 b' ~5 ~" Y0 T5 p
  27. #include <linux/errno.h>
    # l: A5 W8 U+ d* }
  28. #include <linux/types.h>
    6 F* s+ k( i* {
  29. #include <linux/interrupt.h>
    : J# @+ N! S5 X& t3 O
  30. #include <asm/io.h>' Z( u: F( w( F
  31. #include <linux/moduleparam.h>* V5 @; z6 H: B' j
  32. #include <linux/sysctl.h>
    4 f/ z4 @7 ?8 z" P7 {" n9 Y; P, T
  33. #include <linux/mm.h>
    / F8 {, C! o: A, j6 g% {5 E* k
  34. #include <linux/dma-mapping.h>
    6 T" M' a5 o1 m4 N+ c9 y6 ], D' Y; _! ^

  35. 3 l7 s& j& K1 c! S% L% J
  36. #include <mach/memory.h>9 K. _/ j+ T$ w# U) {! @% F
  37. #include <mach/hardware.h>+ `' U( d% K& e5 D" G
  38. #include <mach/irqs.h>
    * N0 Q. f% p, w9 `; J  h
  39. #include <asm/hardware/edma.h>
    % @9 l" P! _0 d" f6 P7 c
  40. 1 m5 U# A* Y/ R, R/ q! o$ b
  41. #undef EDMA3_DEBUG4 w' ?/ c8 G) y4 D5 Z+ T
  42. /*#define EDMA3_DEBUG*/
    * Q0 Q# S8 N- v: Z& M) P/ U3 n+ f' v; Z
  43. + J. _. c- N- k* Z- @
  44. #ifdef EDMA3_DEBUG, |$ h6 t4 v, e3 V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 l6 ?+ T* Q* K* n1 y! Q0 k9 n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 Z& w! C! Y( t8 u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 f+ V9 T0 J' ?
  48. #else' g/ O* i) k  w* [
  49. #define DMA_PRINTK( x... )
    2 b8 q8 I& ~9 I$ Z8 c( r
  50. #define DMA_FN_IN6 X' p3 p& _. E+ b: q* B
  51. #define DMA_FN_OUT
    3 {) U. y# n( s9 j2 V. h
  52. #endif
    4 F5 A% r- t, t0 [- m

  53. * p8 W0 {' W1 t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ M2 g. ~" K$ c6 m; C
  55. #define STATIC_SHIFT                3
    - J& C3 w% r; W  g
  56. #define TCINTEN_SHIFT               20
    0 _' M' v; r  c3 ?
  57. #define ITCINTEN_SHIFT              21
    2 o, q9 Y7 Q) a
  58. #define TCCHEN_SHIFT                22. @7 K5 Y- Z/ t+ o$ ]
  59. #define ITCCHEN_SHIFT               23
      Z1 v7 K( M5 W- }  m

  60. ! m4 b2 }4 S  Y; U) x
  61. static volatile int irqraised1 = 0;
    1 D( @3 o* q7 e  x" }
  62. static volatile int irqraised2 = 0;. K9 t6 t. `; D, A6 ]9 u+ W7 E  O

  63. - B% h8 q% q4 r0 y+ b: Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # w! E1 Y, _" Z, z+ ~  i- X$ z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( B7 C' n! K7 K) @& I8 E1 M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ w* J( D7 J# {9 t1 Y  a" I" H

  67. 9 R2 \% z  Z/ k7 ?7 l
  68. dma_addr_t dmaphyssrc1 = 0;
    ) P  _' Q4 H; X. Y: t6 _; Q6 O
  69. dma_addr_t dmaphyssrc2 = 0;
    ) @9 V! f, ^( c' @, Z9 K
  70. dma_addr_t dmaphysdest1 = 0;
    % }  z) M8 d# v9 ^# G* d
  71. dma_addr_t dmaphysdest2 = 0;5 S# I6 o. b& T8 X7 D
  72. , q- x, a( V* p  F" U6 j8 D$ k1 w
  73. char *dmabufsrc1 = NULL;. l5 k9 a* S6 t; |$ O5 h& a& g, g
  74. char *dmabufsrc2 = NULL;% k1 C, Y1 C0 o. I  M( a6 s; j
  75. char *dmabufdest1 = NULL;
    - u( Z5 @' e1 W9 r+ [' W- |
  76. char *dmabufdest2 = NULL;
      U( R+ M9 s0 k  K8 O& I9 y9 y9 K- G+ Y

  77. 9 ^4 P$ D7 A6 R4 k# s& t& H; e
  78. static int acnt = 512;
    & t# X3 |( ]9 j+ p+ i+ H6 F+ k
  79. static int bcnt = 8;
    # A8 F* H1 I  `8 a
  80. static int ccnt = 8;0 a1 c3 u9 J& p- J" K

  81. # B+ ?9 }) x$ z! k) f, }
  82. module_param(acnt, int, S_IRUGO);8 {+ S5 }3 k. n& @" `6 ?7 a6 X
  83. module_param(bcnt, int, S_IRUGO);" i) P, i0 O! v& a: S# x. S, F, v/ Z: K. k
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. y, s8 x0 n+ y8 q8 C! B  `

$ S' S8 ?* V& H/ h6 ~; d4 b  l! z! v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 M) [$ h7 }! ~4 c' Z8 o; V. @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. [/ V* j. N. a9 i  S1 c     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 C1 [0 M; R6 _6 t8 b& x8 g* B$ H9 y5 w! Q

- w; Z+ F: [7 j" c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-24 15:29 , Processed in 0.040606 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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