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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: |0 f8 }0 P; P- f5 N/ J
  1. [code]EDMA sample test application. J9 f0 r  h* ^$ j) L$ u& ?
  2. /*7 o. a9 Q1 u* v9 e1 ~* ]
  3. * edma_test.c
    5 G( J1 x. }. a. v/ H. g
  4. *
    ; K! `1 N$ {4 [4 H
  5. * brief  EDMA3 Test Application, e0 Z1 I: z1 t& M2 |  ?
  6. *) q& {  S4 l) j" f% @
  7. *   This file contains EDMA3 Test code.. X' d4 S8 |4 k, k: K8 q! v! f" c
  8. *" y0 ^8 \! K, T! m8 i* R5 U* O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& Q1 U6 F) v3 ]3 W1 p2 ^5 `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! [( J( h! H6 i) c1 I# O1 i
  11. *         TO CHANGE.
    ; k0 h. }; n1 q# v
  12. *
    % F/ n( ^% x8 @" k/ n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; J2 }! u2 H" s- ^
  14. *5 a/ S! N' L( [8 o5 c. Z$ ^
  15. * This program is free software; you can redistribute it and/or
    - {. f# g7 ]& e. i% E5 r
  16. * modify it under the terms of the GNU General Public License as6 S. @% G8 e, H5 F# w6 B' B/ m5 O/ y, B2 a
  17. * published by the Free Software Foundation version 2.
    . A+ M! i3 S, N5 K& R
  18. *+ z7 R% y5 B: Y& o8 c# g" h8 {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 f  t6 n8 N0 i
  20. * kind, whether express or implied; without even the implied warranty
    & J0 b6 g8 V% e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& S  V( W; [6 l5 H- L0 b7 s) e5 |7 f
  22. * GNU General Public License for more details.6 o9 K& _# T" {! n, \
  23. */
    8 S; k) l! a; c

  24. # E- I1 t  q- ^1 y' [% b
  25. #include <linux/module.h>
    2 J# @' O1 N7 S
  26. #include <linux/init.h>  b# s) }, Y+ }) C6 l# ?
  27. #include <linux/errno.h>
    9 M; U0 D4 N2 Y; T* M/ M  c. i
  28. #include <linux/types.h>
    ( s) z6 w. U# p! g- d4 B% C0 W
  29. #include <linux/interrupt.h>
    . ]7 r7 |3 d& N8 m, I; a, T
  30. #include <asm/io.h>, g3 s7 m6 n* Z0 y: A% ~- d: ^
  31. #include <linux/moduleparam.h>1 Y9 r+ i0 H9 Z5 i; Y. Y" W, ~
  32. #include <linux/sysctl.h>+ f, }% I1 r* _& p
  33. #include <linux/mm.h>
    % i' t/ }# V  }8 v
  34. #include <linux/dma-mapping.h>
    + X5 A7 c7 R6 S) f& Q- Z& n
  35. : i. y# l+ ?+ N* c1 }3 M
  36. #include <mach/memory.h>
    1 G! T5 a+ z1 q9 A3 C
  37. #include <mach/hardware.h>1 l! S, k, c3 `% f# O; ?
  38. #include <mach/irqs.h>- i. {# [+ s5 I4 e
  39. #include <asm/hardware/edma.h>
    9 M8 k8 c- _: l* `# A) V
  40. " Z/ j4 l' ^" x$ P( x4 r7 N& S
  41. #undef EDMA3_DEBUG
    7 t) b1 y% F$ p& h) ^  L3 [* T1 M
  42. /*#define EDMA3_DEBUG*/
    " f' ]* I/ v- i; R

  43. : s2 @9 U1 c; i! R2 Z) w
  44. #ifdef EDMA3_DEBUG
    & ^' J: s5 d, ?: U# a; j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; T9 C" O9 A1 A6 J/ c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 ]# u0 ], g: M9 _- E  b3 L: y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' K+ R) P. h% F' o
  48. #else! r  ~8 v' D4 S& U
  49. #define DMA_PRINTK( x... )3 k0 x* a7 @/ C4 y) X
  50. #define DMA_FN_IN
    3 g) z1 x! Y" Y& R% E. u
  51. #define DMA_FN_OUT3 `, o2 P& g9 l! {% y
  52. #endif
    ' c/ [4 Y( E# P) d8 Y$ n
  53. 9 o4 e& M* J% k! L& A* l$ F& Q& R& \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! A7 O! `. ~2 Q) k
  55. #define STATIC_SHIFT                30 E: e6 U2 O0 {7 ^
  56. #define TCINTEN_SHIFT               20
    7 ?6 \% X) D9 O2 N1 {& U3 d# A
  57. #define ITCINTEN_SHIFT              21" F/ F5 c) f  d! s$ j" ?
  58. #define TCCHEN_SHIFT                22
    4 u' Z$ k5 G6 d  j/ ?( e
  59. #define ITCCHEN_SHIFT               238 m( g$ k* \8 O1 N- K1 J& c

  60. ; X& D+ `% S0 P$ V/ S
  61. static volatile int irqraised1 = 0;- V& u8 ^* r7 y
  62. static volatile int irqraised2 = 0;
    " w. Y$ ]. S& P. g
  63. - P1 o$ n# O, C' `) q/ b7 P4 x( v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 o6 z# |% t# o8 G! q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 }; U' \; H2 ^1 ~' h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 N8 {( w: g& ^0 R! V- I9 [$ _

  67. ) s, J) p+ R( }, J1 e
  68. dma_addr_t dmaphyssrc1 = 0;. @9 [- b2 t5 {  a1 n
  69. dma_addr_t dmaphyssrc2 = 0;2 Y4 |  T4 q/ D6 D5 k& ?
  70. dma_addr_t dmaphysdest1 = 0;8 G* x1 Q6 k4 S/ e8 x. K
  71. dma_addr_t dmaphysdest2 = 0;! v3 _" {8 N; o1 q. _$ m$ j4 f$ l9 v
  72. 5 }0 Z% V) ~4 A- r$ `
  73. char *dmabufsrc1 = NULL;
    4 |! A1 [( P. A+ q& m" P
  74. char *dmabufsrc2 = NULL;5 ^  W- |6 T! z% ~  ~7 j- [
  75. char *dmabufdest1 = NULL;( i; O4 D5 ^# m! H
  76. char *dmabufdest2 = NULL;
    2 v4 i' h/ G! K, _  x* c
  77. % D% \' N0 m/ @$ z& z8 g# B( |( b
  78. static int acnt = 512;; ?# m- s( d  l3 @6 e
  79. static int bcnt = 8;) ?4 ^- Y3 q" u+ ~1 `
  80. static int ccnt = 8;
    3 J$ q9 t, W- I4 M5 h5 l  P
  81. & u' f- e4 b7 o5 n0 F
  82. module_param(acnt, int, S_IRUGO);
    " ], T0 \1 O- |, Z; b
  83. module_param(bcnt, int, S_IRUGO);# P/ x+ Q, Y9 L/ @6 e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; H& n; ?( h' ^: D1 S. l& @' u8 m/ {# k0 Z' G. C3 ?
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 k) B  C7 e) ]- \* j' z( a# U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& x  [' ?( [6 }5 y3 s0 R! W$ A+ O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* Z' t6 U+ C% E3 r
4 Z2 x# B" a' Y% T" A* Q: k( _
' z9 p) s& r& ~1 L7 g( j4 M5 v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-30 22:32 , Processed in 0.039850 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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