OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: q, u( {$ z" O' V
  1. [code]EDMA sample test application( |" Q: \7 F& u( {: o8 t7 \
  2. /*
    / C3 ?+ G& z9 A! P' W+ T; X
  3. * edma_test.c
    # P: J$ {  C. m8 L" d
  4. *
    % ~/ P/ Y6 c* U3 n% M% v
  5. * brief  EDMA3 Test Application
    ( c8 J; ~" g7 z% N1 M# o- P/ y
  6. *+ ]; l' e7 R5 k/ o
  7. *   This file contains EDMA3 Test code.( Q& [3 s7 R6 B8 w
  8. *5 A  j( i  B: m, {+ C( S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 X) s1 T: h  J: w7 U: \( Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; q. `7 ?1 v2 T: z% `* i
  11. *         TO CHANGE.
    # p" [8 c! I7 C
  12. *& M. j% Y# l* h0 \) s. t% @# c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 P! E! Y4 C, c
  14. *
    5 H+ T$ R3 K) P( R! j, q; W
  15. * This program is free software; you can redistribute it and/or
    2 |( [# M0 I& R8 X  I2 g
  16. * modify it under the terms of the GNU General Public License as
    ) g8 @+ e+ M# D: [" s) _6 F/ ?
  17. * published by the Free Software Foundation version 2.% ?" q4 g/ Z( {# {6 N. w2 t
  18. *7 _3 x4 g$ D1 W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 ?7 s, s* J, u8 j, k* o8 r4 j* e
  20. * kind, whether express or implied; without even the implied warranty
    & a/ m) {) F1 r" I) A( N" C9 r5 U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 S/ S4 }# _6 P9 s. b
  22. * GNU General Public License for more details.
    ) U7 l: U; x0 P
  23. */
    / t1 ~8 v3 p0 N0 D

  24. 6 m; f" J; g' F, I$ c
  25. #include <linux/module.h>
    ( \3 k$ z7 i) n: J$ ?/ H& M  r
  26. #include <linux/init.h>5 B' r% Q- _7 t3 L. ^: G$ |# T
  27. #include <linux/errno.h>; ]& t/ ^, V4 |) f1 w  @  A8 `
  28. #include <linux/types.h>
    1 ~9 {( c  @- ~/ c& s) J) R
  29. #include <linux/interrupt.h>
    4 s) u+ G# M$ O. b% P2 {
  30. #include <asm/io.h>. k' m2 x% ?, l
  31. #include <linux/moduleparam.h>1 @5 I& i. |4 j( v
  32. #include <linux/sysctl.h>
    7 y4 s- p8 R* U4 t
  33. #include <linux/mm.h>
    - p9 N! i9 T) C/ s( F' [- h& t
  34. #include <linux/dma-mapping.h>
    * ~$ x+ H$ z5 Q4 F, O
  35. 5 W) M' v) I& I: {7 n* a) ?& x
  36. #include <mach/memory.h>! _: c( M! ?" o6 @, B; `
  37. #include <mach/hardware.h>; |; u" I, o0 r  T- w$ A
  38. #include <mach/irqs.h>! ]0 g3 p: e/ R2 h9 f4 ]1 F+ ?! r5 R
  39. #include <asm/hardware/edma.h>' M0 [" O+ V. F; R! ~# D' V
  40. . C$ q/ Q- d9 D7 v/ c$ m
  41. #undef EDMA3_DEBUG$ b7 \& v& p! u+ ?# u0 D/ `+ a
  42. /*#define EDMA3_DEBUG*/
    ; s3 M9 ^9 b1 Y2 h  j
  43. # x5 V7 B& b% M* H
  44. #ifdef EDMA3_DEBUG+ s& C- b6 {- {, E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ ^* z; o0 }, ?2 q" M# F: F5 ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % h; J( `7 U  r; P7 E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " Z4 Z8 j+ l4 [( R  @8 p
  48. #else4 b7 Y  y" C+ Q! n
  49. #define DMA_PRINTK( x... )
    ) ]0 y9 V* n( A2 {6 C% e
  50. #define DMA_FN_IN
    8 T& y2 f( H& G4 ]' A
  51. #define DMA_FN_OUT
    / `( o% P/ }! ~; l$ f& {$ e/ X, d
  52. #endif5 r( P+ b3 P) a8 x* F
  53.   L/ D8 F, `( c+ d, S2 x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! j4 O; L' ~! x6 D. c  K5 Q
  55. #define STATIC_SHIFT                3: ?  G0 `: J4 j1 H7 O& k$ U
  56. #define TCINTEN_SHIFT               20
    ! h& F1 K: e- z9 P% v) I
  57. #define ITCINTEN_SHIFT              216 p9 C. I& S8 P$ b" S( L% W
  58. #define TCCHEN_SHIFT                22, e# B% \: g9 I! K3 O
  59. #define ITCCHEN_SHIFT               23
    ' d. s. Q% B5 D% Q* i
  60. ; m4 [2 l; U; g+ m1 N) d
  61. static volatile int irqraised1 = 0;3 A. y# O3 X: R, k' J) e
  62. static volatile int irqraised2 = 0;8 _3 j- b/ s3 r+ _$ j# \" m+ ]" n/ r

  63. , @, y$ P. q/ p+ O. s' w; F' ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ j& d7 P$ k# \9 f- Y5 O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & o& j; u2 t8 O# s! V( R( N4 d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' ]0 D! o: b5 n7 u2 k5 t
  67. ' {) g/ d9 R, N( h- [0 T. o/ o
  68. dma_addr_t dmaphyssrc1 = 0;- S; X% y3 `/ r3 p  e( i
  69. dma_addr_t dmaphyssrc2 = 0;
    7 T3 N3 |0 V) _3 h9 i! F0 R6 S  P
  70. dma_addr_t dmaphysdest1 = 0;
    # B0 `2 U* n- Q8 o* H# ]
  71. dma_addr_t dmaphysdest2 = 0;
    , R: n9 ]  |/ w( `2 ?5 [* a2 n% S

  72. % e& G; c+ U9 `, A
  73. char *dmabufsrc1 = NULL;5 n. {/ e! Q3 z. _, |4 w. O
  74. char *dmabufsrc2 = NULL;
    " j* a& a5 S. Z/ T; R0 ~
  75. char *dmabufdest1 = NULL;
    5 Z* E# q: Z! X" i
  76. char *dmabufdest2 = NULL;
    & H* x5 g, i' K! u9 j  |7 D
  77. / U$ x4 Q3 e. ?, N/ C* d
  78. static int acnt = 512;7 y) v0 \& t7 c  ~
  79. static int bcnt = 8;
    . u& R# h7 i% p/ T, T( |0 Z
  80. static int ccnt = 8;* R0 r0 j2 i, i; j1 }4 [' q

  81. $ M: G2 t: Z/ Q& k: ^2 k  a# k, O
  82. module_param(acnt, int, S_IRUGO);
    + x2 B7 c/ v/ d* U3 M
  83. module_param(bcnt, int, S_IRUGO);
    / ~  Z+ n7 O0 T& ]$ n4 D; U1 w* U
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% Y7 H0 |7 \4 L& g

5 O# w, E7 `; j0 M" ~+ D! ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ A! {' E8 D9 H' }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 p" J- t/ ?2 x2 Q2 h; z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  ]' N; Y- a: C+ Y: i9 ]
  c+ F9 X  F  x2 J. U
+ c. o: c% e' V5 v8 Z  b1 u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-10-13 06:30 , Processed in 0.036533 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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