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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ s% i. G0 G9 l/ r' a" t
  1. [code]EDMA sample test application! o8 F+ N" g: }& d7 Y: v+ G* @
  2. /*( x/ I7 B# S8 `4 D# b: g9 n
  3. * edma_test.c$ D+ F* a9 O) M
  4. *# e! p4 u0 l5 I  ^: J/ }1 H# \
  5. * brief  EDMA3 Test Application
    - V0 x4 y1 j/ `1 Y; u5 ^+ w
  6. *
    # x# Z* }0 k! ]& b8 }9 c$ K( e
  7. *   This file contains EDMA3 Test code.% k+ f9 G1 h- b
  8. *
    : P2 ]! x) k% T  v7 z7 j* W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) C. f! x1 r/ f6 H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! R- c: {- E- e- R# x1 X3 _" U" n
  11. *         TO CHANGE.6 [! E  {" R2 Y+ G7 m
  12. *
    - S& H; S& x( O# Q% [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 P$ \4 D# ~6 j* s
  14. *3 k6 P2 U0 f7 j  @
  15. * This program is free software; you can redistribute it and/or1 q- B4 g  J- M5 }8 l
  16. * modify it under the terms of the GNU General Public License as
    $ Z! @# t9 C3 N' C3 t5 G$ x
  17. * published by the Free Software Foundation version 2.
    ; I5 }7 q9 E4 P& A
  18. *
    7 [! v& Y1 z( d1 t) V5 m) Z( j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; O4 @( n; @  V# n
  20. * kind, whether express or implied; without even the implied warranty7 P1 y$ X+ N4 d1 t6 g# ^8 V1 a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . v( z0 X% m1 D. G
  22. * GNU General Public License for more details.+ j& @; t5 a/ j  g1 C
  23. */
    0 e. @! ~4 {+ _
  24. ) Z/ A3 {+ y$ \7 k5 d
  25. #include <linux/module.h>
    8 D, ]! B( ?# }8 r3 G6 L$ H$ ~1 P
  26. #include <linux/init.h>
    - M; t2 ]& r- S) `
  27. #include <linux/errno.h>  S8 a- t4 B1 o; t  y% n2 S* F
  28. #include <linux/types.h>
    ( l* \6 {' p2 C) N
  29. #include <linux/interrupt.h>+ z" U# P' P; O/ G/ K8 e: v
  30. #include <asm/io.h>: y# b# i' B+ a) `4 d0 M
  31. #include <linux/moduleparam.h>8 t, ?6 j7 E5 L% O6 P( g
  32. #include <linux/sysctl.h>
    # Z0 g' @+ p2 C6 W
  33. #include <linux/mm.h>
    5 @# R7 L, x. E7 V3 ^7 n1 b% K- J
  34. #include <linux/dma-mapping.h>
    $ S4 {' V. x9 E1 \5 ~
  35. & i% v9 u5 k- d8 b
  36. #include <mach/memory.h>% }, P* ~9 I1 U# Z
  37. #include <mach/hardware.h>) n4 t9 @6 ^0 [6 o# @9 `' o  S
  38. #include <mach/irqs.h>
    $ N; r- G3 Q' u4 O$ s& Y, S1 F) Z$ V
  39. #include <asm/hardware/edma.h>; ~" i" z8 J6 S/ M! s

  40. 8 J& X  q9 R; A3 C
  41. #undef EDMA3_DEBUG
    % f, h: _0 V2 E
  42. /*#define EDMA3_DEBUG*/
    6 ?4 g9 \3 a/ r+ w0 L7 K% F

  43. ' i7 v6 F6 W; ?! Z6 _$ N3 a
  44. #ifdef EDMA3_DEBUG
    9 N6 M. d1 |9 n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 ~$ I. w7 m: f0 e+ I. o7 n$ n% v( u9 d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 G% k- w% e4 {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ `  s5 P- E. O7 r* h& F2 ?% m
  48. #else( g/ _9 z, j3 M! u( t
  49. #define DMA_PRINTK( x... )
    % q" m5 U& f  B
  50. #define DMA_FN_IN
    7 ^) j: m+ l7 m5 M
  51. #define DMA_FN_OUT
    7 M1 ^3 m. e" t4 A/ r
  52. #endif1 s9 |4 ?/ i! b1 r. o

  53. 3 z' S. t. _' C2 M- O7 k, o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& `2 p; P* U3 ~
  55. #define STATIC_SHIFT                3
    0 t6 b+ d+ f: r$ O4 p  z. ?
  56. #define TCINTEN_SHIFT               20( i+ B: Z3 y2 J/ d
  57. #define ITCINTEN_SHIFT              21
    5 O' C7 E: X+ W% H$ ?0 u# _! X
  58. #define TCCHEN_SHIFT                22+ J3 a8 V5 T% ~/ Z4 x5 I
  59. #define ITCCHEN_SHIFT               23
    + j/ p* x! K( p' f5 U* W2 o9 Y
  60. $ N" W) Z$ C; A# X- B5 J
  61. static volatile int irqraised1 = 0;
    ! E2 |( _. H& d  X( F/ v0 j2 A
  62. static volatile int irqraised2 = 0;! R  u5 ^) \$ _' q

  63. # l, N# a6 J+ n( I8 L4 m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ~6 G( R! p. A8 c  F8 M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / B- A  X' ]  p9 z5 \+ ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ l, Y7 C0 S& S! ~% ^

  67.   o+ D5 b# `$ g4 c9 w3 y& Z, q
  68. dma_addr_t dmaphyssrc1 = 0;
    ) q2 v0 N3 ]' S) m9 l
  69. dma_addr_t dmaphyssrc2 = 0;; q* H9 Q7 O! @& g: c
  70. dma_addr_t dmaphysdest1 = 0;( m9 B  U- U2 u$ Y7 y0 d
  71. dma_addr_t dmaphysdest2 = 0;
    7 ^( F* \. b, p) f
  72. $ ^- L7 ~1 C# f2 V2 S' Z; ]* q# o
  73. char *dmabufsrc1 = NULL;1 [! r% I0 D8 Y# i/ \/ A, q
  74. char *dmabufsrc2 = NULL;
    $ I1 t+ r( ~* z1 T: @
  75. char *dmabufdest1 = NULL;, O5 O2 ]3 M' X
  76. char *dmabufdest2 = NULL;: Q+ O/ B; i! S1 X
  77. ) |) V" o+ ]# @8 ]$ j+ O
  78. static int acnt = 512;# K; p# y  O* [9 @% e* D5 m
  79. static int bcnt = 8;2 V* P+ S1 D7 g
  80. static int ccnt = 8;
    6 j) Q; K- z+ i, w' m/ c. j
  81. ' x" p* ^6 N& }. k
  82. module_param(acnt, int, S_IRUGO);+ x' \2 H0 h$ C: z
  83. module_param(bcnt, int, S_IRUGO);
    ' V/ t8 ^2 H6 Z- S" z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: w! B+ u; n# n& l8 z
( Q$ X) ]7 Z6 G- K( d      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: j0 ^" y; Z2 T9 k* J5 Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: Z& t* K2 v) P! c. N
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 H$ g5 k: n" r7 |3 H# ?

, |0 {  A4 X; X% @/ Y2 w  {* ~
& V4 [' t- l" F+ l) x; A5 B& c/ ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 13:11 , Processed in 0.040744 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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