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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 f. [) ]) C0 Y7 K1 H. X: V
  1. [code]EDMA sample test application9 {! j- \6 Z6 v4 @4 K3 Y
  2. /*0 t" k4 W/ i! R5 G
  3. * edma_test.c0 q; ?! S* ?. s; m( C0 S
  4. *' a. L; @+ J8 k0 t
  5. * brief  EDMA3 Test Application
    9 q; R% _& F5 n7 V1 Z5 `9 a* P4 ]( R
  6. *
    4 ?) U1 y$ w& w% c# O8 W1 U+ }
  7. *   This file contains EDMA3 Test code.
    ; b9 n2 a$ E8 @9 D% C3 `4 i
  8. ** O% p4 N% E( Z' F# a4 @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) B9 `0 g$ j3 R, v  q$ |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# z) Y( T; o' @& }2 @
  11. *         TO CHANGE.
    ) l/ {. I; F" G
  12. *
    . R4 s1 Y4 m7 s; `1 t3 n% i- e" q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) }" |( a& B7 h. e  D
  14. *
    8 w; y* ?/ ?4 x1 K
  15. * This program is free software; you can redistribute it and/or
    9 }, J. g" `7 p) X  L# u; T
  16. * modify it under the terms of the GNU General Public License as
    % {0 J& x' ?3 b3 J
  17. * published by the Free Software Foundation version 2.
    0 R( n0 s7 z& C6 S) M
  18. *6 c) n- T1 z6 A. h* O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' v% x* P+ G9 p6 U: v/ g
  20. * kind, whether express or implied; without even the implied warranty
    1 {9 p# j7 @% V; s9 V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! s5 P, j6 J6 V1 [9 A2 X
  22. * GNU General Public License for more details.5 q- ~: f& _( k: p; i! o
  23. */, \1 j2 f; o& N: T
  24. ) A! c! D. d9 ]9 s1 R0 P" [
  25. #include <linux/module.h>; w2 t  L+ u9 y( t0 Z
  26. #include <linux/init.h>1 z& I! u) c1 e# G: \) w- [
  27. #include <linux/errno.h>
    # o9 t) O, F( {7 n* i/ D- N
  28. #include <linux/types.h>, n9 H6 d9 H6 s$ g# x( p* X9 [
  29. #include <linux/interrupt.h>7 w" O0 J) o" O% X% G, o9 W4 Q
  30. #include <asm/io.h>( B& x% m, }2 t* I" c
  31. #include <linux/moduleparam.h>1 F6 _6 q& ]2 A. H$ {
  32. #include <linux/sysctl.h>0 v9 k' t0 S2 g( k1 U) p/ v
  33. #include <linux/mm.h>- O) f5 G8 q" M- p
  34. #include <linux/dma-mapping.h>
    * r3 l! U% X0 {5 b! B
  35. $ |1 ~4 w% Z3 ~2 q
  36. #include <mach/memory.h>
    # Y3 I2 t" `, e2 j, X& A) n
  37. #include <mach/hardware.h>
    $ [' Z1 b. \" y# s, L1 g
  38. #include <mach/irqs.h>4 y4 y! g7 K7 P7 R
  39. #include <asm/hardware/edma.h>% f' T8 o4 q- E* \! A' f+ ]
  40. 6 o4 y# a  a* T5 Y6 P5 ~$ X
  41. #undef EDMA3_DEBUG
    0 t3 j4 r5 ?" a+ X7 D  g/ D4 J2 l
  42. /*#define EDMA3_DEBUG*/
    + B* O+ C: k+ u6 a% Z
  43. 5 @0 s  ^+ P5 M* j2 c* d8 `
  44. #ifdef EDMA3_DEBUG
    7 c* L' q) X1 n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - X. V8 h# x) E' G/ x- {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 I2 R  ?4 F+ k# B4 F2 q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # l+ }0 K, S. [$ w# `: `
  48. #else
    7 t4 V# T: u' C
  49. #define DMA_PRINTK( x... )) E6 A4 ?5 ]1 m4 p( m' q
  50. #define DMA_FN_IN, L6 A. x7 Q& W" M9 q
  51. #define DMA_FN_OUT
    9 \( z! x4 X# P) z" `6 e+ h, b
  52. #endif
    # o3 e' n9 c% H. L2 v. X/ K, g

  53. % u% D! [3 D% \6 c7 ~# t1 {8 J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , {. J( I8 M6 s2 i) S; j, y2 [
  55. #define STATIC_SHIFT                3' {9 y* V; V" Y  @1 {6 }& }/ F2 S
  56. #define TCINTEN_SHIFT               20  D3 }2 r9 y' q& i9 j5 S
  57. #define ITCINTEN_SHIFT              21$ V" R2 r$ c; y0 ~9 d1 r
  58. #define TCCHEN_SHIFT                22
    3 K7 |. _; ^3 f* B( J6 {
  59. #define ITCCHEN_SHIFT               23
      B5 h+ P! d, v

  60. ; t9 r3 M0 x7 @% U4 Y
  61. static volatile int irqraised1 = 0;9 D. a! I/ k, ^4 P: o; Z' H" g, r
  62. static volatile int irqraised2 = 0;2 K5 G8 ~/ W% `! D
  63.   G5 }. w4 s. t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 x4 V3 B+ R3 O% {: r/ l7 \. G( W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 t, S- ]7 A7 s( {6 S! H5 ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; d. N' A3 R( @$ S: [2 U

  67.   H2 ]7 C3 n  `. A. [0 ]- k. T9 T$ \
  68. dma_addr_t dmaphyssrc1 = 0;
      k2 [# O" `3 N# b9 C5 t
  69. dma_addr_t dmaphyssrc2 = 0;
    5 O) j3 q" q. Q, v" n3 c
  70. dma_addr_t dmaphysdest1 = 0;
    " j6 M0 C4 {) s& B2 L
  71. dma_addr_t dmaphysdest2 = 0;: }# b; R" g8 c. o, w" P  F0 C
  72. $ k/ M# |$ w7 S. M0 l2 w
  73. char *dmabufsrc1 = NULL;3 {4 h6 v4 p7 I5 x7 z% z
  74. char *dmabufsrc2 = NULL;1 K% |+ f& G0 u, o* ?
  75. char *dmabufdest1 = NULL;: Q" ?( o& B- o6 z! t0 N+ O( w5 r: W  J
  76. char *dmabufdest2 = NULL;
    : Q( {1 Z* `: S( |

  77. " b- Z' W; s2 O9 x1 I
  78. static int acnt = 512;- G" l. g- u) Y1 D, [+ ^
  79. static int bcnt = 8;% E+ O9 Z7 p1 Q1 z! {' o2 \
  80. static int ccnt = 8;
    % j7 J8 H0 M9 r$ o
  81. & {2 N$ H. U4 O) j% g1 E6 p- F* q6 B
  82. module_param(acnt, int, S_IRUGO);- n" {% R5 o: }- Q" _: P+ B
  83. module_param(bcnt, int, S_IRUGO);& _5 Z+ P( s$ T
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; b7 C) k7 u& r8 Z# V
% p% T) m  b& V/ `: F" N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ }' K, `, t6 I" g, Y6 Q; v3 Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, }7 T& l5 {' L3 F9 _4 N
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ N! f7 _8 U- U

' F5 o. ]' U: y( h( s2 u
5 {  Y" K: H, b6 F$ d9 D2 \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-16 14:12 , Processed in 0.036089 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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