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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 F3 o# {9 b" Z+ v0 J
  1. [code]EDMA sample test application
    - B9 _. a! m* t) K  v
  2. /*
    , o2 Z) ^5 ~4 Z( e4 `& Z
  3. * edma_test.c
    0 }' U% }- F, p; l! X9 {
  4. *
    ( B' U3 q4 J) E; N
  5. * brief  EDMA3 Test Application
    % R4 E5 Y& W( J" e! ]9 [
  6. *! i& f6 S$ Z" s- z/ @3 ^4 l3 O$ a
  7. *   This file contains EDMA3 Test code.
    - ^5 }) ~1 h) P9 H. @* d
  8. *9 e: R& r7 T: a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % @9 u* E% S7 J! b$ C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; |2 F9 N0 T, `1 P, ^& A! ?& j5 g
  11. *         TO CHANGE.
    , q1 |  o2 J. f' G! {4 n2 l% j0 ~
  12. *
    0 ]( n" F4 ~& d& x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - [3 U/ g2 x: I4 X& h) X8 z
  14. *: i; G. \4 r# b, w3 o0 M
  15. * This program is free software; you can redistribute it and/or
    5 r; f4 i% j4 L5 ]
  16. * modify it under the terms of the GNU General Public License as
    2 P7 b, x9 ^# V$ N6 V
  17. * published by the Free Software Foundation version 2.
    ) y' q) r3 j# k2 {* `6 m' ]( Y
  18. *' K3 q. V) c% j% G+ n7 U8 T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ k+ ^' S$ X! y5 }
  20. * kind, whether express or implied; without even the implied warranty
    8 w. o% o; `# y6 B0 \/ q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 H. ~# T9 ]% V. z
  22. * GNU General Public License for more details.
    7 n% ?/ ]+ \: |( K9 t* Z& o9 ?
  23. */7 h6 y. T7 K" I- T) K
  24. # ?# n) Q% d7 ?$ a' I
  25. #include <linux/module.h>
    - Q  r: U& v7 B" U$ U
  26. #include <linux/init.h>
    1 n% l5 ^2 Z& j8 K$ w6 ]
  27. #include <linux/errno.h>5 G6 G4 y5 `- @; r
  28. #include <linux/types.h>' B* H7 W$ s& z3 B; Y& X# y
  29. #include <linux/interrupt.h>1 v- M  H2 }; O" _% T* a8 L  D
  30. #include <asm/io.h>. e; ?+ \/ R' m) w* }
  31. #include <linux/moduleparam.h>
    " ?, R0 \! g# b3 ?
  32. #include <linux/sysctl.h>
    ' U6 W# T2 e- n
  33. #include <linux/mm.h>0 P, k- m$ |, y! r
  34. #include <linux/dma-mapping.h>
    / B7 I& e! |+ |4 N7 d1 A& M1 q

  35.   f5 T9 H2 z4 ^& e1 D, D5 `
  36. #include <mach/memory.h>2 T- g0 ~; @3 w+ i
  37. #include <mach/hardware.h>$ }( z6 j& l* M- E: d
  38. #include <mach/irqs.h>$ }. k; E( e) Y( p) V0 g/ [! n
  39. #include <asm/hardware/edma.h>- F7 @1 P  p3 `7 m% f- V

  40. 5 p0 x7 T* t) e  \4 D& w" m
  41. #undef EDMA3_DEBUG
    $ l3 l* V4 B! ?6 }
  42. /*#define EDMA3_DEBUG*/
    + O& u* O' t1 y. A

  43. 9 s4 S( y$ E5 l" ^% E9 v! @
  44. #ifdef EDMA3_DEBUG8 P- S* E$ ^, {: H; M" a/ D( K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( S5 g: j6 L# N1 s# r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% b3 U  |! t3 L- d9 U) e; s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 }, E! C% }1 u: B, ]5 N8 y( V
  48. #else
    4 o6 O1 x& X, D) B# j% k
  49. #define DMA_PRINTK( x... )
    # \7 X; F) u3 q9 @
  50. #define DMA_FN_IN
    " ]6 g6 {# r4 C, d0 M9 j
  51. #define DMA_FN_OUT
    . c5 v& j% T2 W% h
  52. #endif
    3 T4 m; J7 O0 a: m. L
  53. / ]9 d5 F3 L! n2 j7 o8 Q. Y5 n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! X) Q. n& R: E% F/ q: w
  55. #define STATIC_SHIFT                3' i$ M* `4 z8 x. t: N
  56. #define TCINTEN_SHIFT               20
    * E  K$ `) y3 N7 {; {: b
  57. #define ITCINTEN_SHIFT              21
    $ M- m  O6 J% m/ K5 O8 s
  58. #define TCCHEN_SHIFT                22
    9 Y! W3 c9 D3 T$ Y
  59. #define ITCCHEN_SHIFT               23- R1 @* j, v1 G5 {( I+ c" B& G
  60. 1 t! {' E4 a$ p* q3 I; M
  61. static volatile int irqraised1 = 0;  B: ~* q7 U  ^0 [
  62. static volatile int irqraised2 = 0;
    " K( U" J% q3 E6 A9 A* t; o
  63. ( n2 S, G1 l* S& w* J3 ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " f) ]5 ~. b# ^3 n& n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : P4 u, n3 X; i) I# b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' c; O$ {3 V3 @( j

  67. $ K9 s0 |7 v" \+ k, i/ U. k: i
  68. dma_addr_t dmaphyssrc1 = 0;
    2 f! @: H( ]3 h* _! O: z* ^9 \
  69. dma_addr_t dmaphyssrc2 = 0;
    / @" o, `" f+ Q- K
  70. dma_addr_t dmaphysdest1 = 0;
    8 p& W; f+ J' ?9 `
  71. dma_addr_t dmaphysdest2 = 0;) E# T3 h  _' I" g' {  I

  72. / k9 V4 W2 a5 e
  73. char *dmabufsrc1 = NULL;( Z$ O1 n4 {+ w+ f2 |9 h
  74. char *dmabufsrc2 = NULL;9 |( H. \) q2 V8 t, T, i
  75. char *dmabufdest1 = NULL;" @$ M, f7 L! ^0 A
  76. char *dmabufdest2 = NULL;
    - r% M" O- q5 d5 k8 c. c7 J: f

  77. ( l0 t7 F# @  _1 H. N+ R/ @* ~7 _4 \
  78. static int acnt = 512;! N1 C' ^1 }2 t
  79. static int bcnt = 8;( }' |2 v3 g% |& k% o9 V
  80. static int ccnt = 8;
    " I% j6 c2 T% T' O- P- t

  81. & g% o& Q4 ^8 X: R3 l9 r0 D
  82. module_param(acnt, int, S_IRUGO);2 Q6 Z8 Q& z. n9 F% d1 l) M
  83. module_param(bcnt, int, S_IRUGO);4 P, Z% i( F8 x5 D% C4 L
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, f; y) l7 |; K# ]# J
' e; T' z% X: w" A; @9 N. r* }
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, W& ^, f& ~8 c& r  ~9 e( u$ Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. L# o% v! \- g1 [7 J6 h
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* K5 }' s0 c/ |1 D4 P( l" h4 ^( A3 r* e: z1 a+ u

+ Y- G! k! X5 z$ q- h# p, C: D/ v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-26 03:31 , Processed in 0.045730 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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