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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 r6 V" Z5 `) M& c
  1. [code]EDMA sample test application  Q6 z" L' Q% ]# S6 n8 a/ d
  2. /*- L0 Z2 }, }# _; n3 K
  3. * edma_test.c
    / }6 z2 K7 q; w; i, ~
  4. *
    - a8 u+ {4 t  d+ h! y
  5. * brief  EDMA3 Test Application
    " G$ [$ H: u, W! s
  6. *
    * S& h8 V4 L* O
  7. *   This file contains EDMA3 Test code.- h5 r* f0 ]2 Y! j
  8. *9 |+ n4 F; M% L3 M, y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) \7 W2 P* {. c; J; F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 a- z, h) Z7 R5 ]
  11. *         TO CHANGE.
    # j0 g  e/ D) B( R+ P. B7 ?
  12. *
    / o3 e# `% T; R" ?+ y" w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 H. M" J6 p. ~: j
  14. *! B2 X7 [0 ^& J. k: ~, F. i
  15. * This program is free software; you can redistribute it and/or
    8 m! u5 a6 R9 i' i6 q$ p+ r
  16. * modify it under the terms of the GNU General Public License as
      m, o. V: Y8 i4 z. h* ?
  17. * published by the Free Software Foundation version 2.8 N& S2 M  r0 ]) O3 p9 L5 c  U
  18. *
    $ \. R8 Z7 ]3 h2 I, t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      e4 s2 [% l( z2 c6 u' ^
  20. * kind, whether express or implied; without even the implied warranty
    0 z1 }$ N3 D$ B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 ^( `  r: L. i( q0 V
  22. * GNU General Public License for more details.
    1 d9 p' e4 u. h) o
  23. */: V9 V2 L2 g! g* j% P3 a' r" d
  24. $ g- d' _& n: w6 e3 U0 v
  25. #include <linux/module.h>! S* K# m+ g0 J2 R- A& l1 f
  26. #include <linux/init.h>
    7 n! \  E$ o' y# P
  27. #include <linux/errno.h>2 Q8 N1 k+ a2 G9 U2 \. s" ]
  28. #include <linux/types.h>
    + S9 h! B% J& N3 O
  29. #include <linux/interrupt.h>
    : |2 i& e0 L$ N! Q% G
  30. #include <asm/io.h>& i9 z: e0 T3 I, }
  31. #include <linux/moduleparam.h>
    : ~/ x" `5 f# N+ D# U8 p  L( \5 D
  32. #include <linux/sysctl.h>* W( I/ l) @% S7 B% e
  33. #include <linux/mm.h>" F" v! |8 \4 G6 v
  34. #include <linux/dma-mapping.h>
    0 v3 F+ E& W0 n& L- i
  35. - L4 S! V( T; x6 O2 G" ~/ x  C5 Y
  36. #include <mach/memory.h>/ @8 m- {  D4 W; u0 x
  37. #include <mach/hardware.h>
    ) k/ c9 ]+ B3 e" d
  38. #include <mach/irqs.h>: S9 `7 f, O! N& ?3 `: S& P
  39. #include <asm/hardware/edma.h>
    1 g6 U9 C8 \+ y' m5 C" J
  40. , ]2 ?1 w* s0 C
  41. #undef EDMA3_DEBUG
    4 J" o- u! p- n* h# F$ e$ b  q
  42. /*#define EDMA3_DEBUG*/- C, x$ T8 v" l4 A# o# U- ^

  43.   k; X+ d3 Z* a0 P7 Y- f. X
  44. #ifdef EDMA3_DEBUG
    3 z3 d: J6 y% [* l3 \$ f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # k" [/ e7 ~. |$ |+ q6 }3 \2 K4 d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 e5 S8 @: V( o& {6 m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 J: R- ?: l1 C& S% o
  48. #else5 c  _5 y; }" A7 E0 F, n
  49. #define DMA_PRINTK( x... )3 Q, s1 Z" L0 n" I+ J
  50. #define DMA_FN_IN
    8 H4 t4 S7 m1 G' U; l4 Q: U% I) ]; @
  51. #define DMA_FN_OUT
      a$ J- a  E( g6 _* t2 r
  52. #endif! k' F3 S. \5 E

  53. 3 D, v5 \! e7 J& Q( h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ ?$ v6 g0 H% M" `7 Z; l
  55. #define STATIC_SHIFT                3- p, K( r( H1 h: P9 i: T+ x7 ]" M
  56. #define TCINTEN_SHIFT               20
    # b# g9 J6 |" U5 i. X( I
  57. #define ITCINTEN_SHIFT              21
    ; j  ]0 W9 d3 f
  58. #define TCCHEN_SHIFT                22
    6 F! t& _. f" k9 J) z
  59. #define ITCCHEN_SHIFT               23- T, L; [2 y$ F# p" K

  60. ) L* S5 c. N8 ~
  61. static volatile int irqraised1 = 0;, b9 |( I$ c4 h0 I; n# Q7 c
  62. static volatile int irqraised2 = 0;
    ( }! {4 B* u' d/ M

  63. " G, A% H: M; l1 \1 |- c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 y+ i, |  o2 L; w9 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , j' b; b7 ^( S. X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  u0 }% L+ t5 E$ F  m
  67. # `/ z# T$ f9 `" x! R4 X! ~
  68. dma_addr_t dmaphyssrc1 = 0;
    + }' Z. h7 Y2 I/ g8 U! b0 V
  69. dma_addr_t dmaphyssrc2 = 0;4 C1 d5 U* o  n% r$ j' D. z
  70. dma_addr_t dmaphysdest1 = 0;
    ; q! u. `! Q; l' {! U8 l5 C
  71. dma_addr_t dmaphysdest2 = 0;4 u% }7 h& u% J# a- n( z5 I
  72. / u$ x9 x  v$ N2 E) |; L" a# K
  73. char *dmabufsrc1 = NULL;
    ' R2 F3 N) {, }8 q8 R3 O
  74. char *dmabufsrc2 = NULL;
    . E  K  H% K$ u. Y( T
  75. char *dmabufdest1 = NULL;- Q; J, T3 {$ s0 }  {' }6 q
  76. char *dmabufdest2 = NULL;
    * P: n7 i/ U5 w$ u9 p( u

  77. + r5 Y8 a8 h0 u8 b; u) K: G
  78. static int acnt = 512;
    7 g  B7 M& m) v+ N* B$ t# Y
  79. static int bcnt = 8;/ w* Z( m! _6 Z8 U, r& s
  80. static int ccnt = 8;5 M, i- p* {7 x. k' Z+ L+ `4 M- ^

  81. $ D# U" A3 e/ z/ r" f5 h
  82. module_param(acnt, int, S_IRUGO);- r1 ^: X- ~& R4 d, h
  83. module_param(bcnt, int, S_IRUGO);
    8 Z& ?) d6 T. Y) |
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; C, x8 g0 ]' e$ S2 n) A5 b
% b- R4 b9 K  W3 e      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ C1 p; n' y+ u0 e
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 t, v! H1 b( C* s* v     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' T+ v- Z: T. R6 ^, |# T! r

/ P% v2 |5 S2 I5 p/ L7 x0 c5 r- x# d# r" _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-10 05:11 , Processed in 0.039419 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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