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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" m4 V0 s, G7 M& Z9 g
  1. [code]EDMA sample test application- D* r$ t3 k% l' a6 V
  2. /*
    ( p1 e2 T; R# o( ^' [/ j1 f
  3. * edma_test.c$ j! N0 L, U! v* s) ~4 j* w
  4. *: c9 n# e6 y$ @* @8 E; y1 c
  5. * brief  EDMA3 Test Application/ O) ]0 C' u) P; v# n- i: X
  6. *
    . m& G$ a/ W: C
  7. *   This file contains EDMA3 Test code.; X- p3 m0 |" U) c1 K4 \( t  E
  8. *
    - ]/ T3 t5 K! Z. ~0 ^( [- W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 T; Y' Z# B+ V) ]2 X( t1 B& W0 N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 e% r, Q6 [1 q# ]3 ]
  11. *         TO CHANGE.3 X) X( u7 K& H+ i! T
  12. *
    4 @/ I' L1 {* v$ X: ^' Q/ {3 |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# e* q3 y9 q; o
  14. *! Z5 l& O% [# d1 N* V
  15. * This program is free software; you can redistribute it and/or4 H; i9 k) K5 z$ G
  16. * modify it under the terms of the GNU General Public License as
    ! B7 T$ @0 }6 e" y$ Q; t
  17. * published by the Free Software Foundation version 2.
    : v# s2 [; m- ]/ r, h$ ?; }# _0 V
  18. *
    * U  T0 f; R# N4 \2 k5 G+ R/ M# E8 W! v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 i- J. o2 g( t1 h. Y1 T* |
  20. * kind, whether express or implied; without even the implied warranty/ U! b( C" o7 f- B: E% l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 r2 U8 _8 O' c
  22. * GNU General Public License for more details.4 @3 D+ k+ ]9 [2 `
  23. */: E" f% J( @. K2 U. {

  24. 9 \& N* u. X  |9 O+ i/ _
  25. #include <linux/module.h>, K, Y3 b. e( S3 @+ ?. w  Q6 `
  26. #include <linux/init.h>% q( b; e3 u, @$ `5 S
  27. #include <linux/errno.h>
    4 ^9 N* O6 i0 W( \/ Z( ^0 X
  28. #include <linux/types.h>
    9 n: g0 x; z1 i' c  \# P& W
  29. #include <linux/interrupt.h>
    7 ?. H' ]2 Q" p6 i' m2 r, C
  30. #include <asm/io.h>9 @6 [0 w  o$ J
  31. #include <linux/moduleparam.h>% ]% Z% d' k6 n  v4 @2 n  [# z
  32. #include <linux/sysctl.h>
    6 y# r( |& t6 C' q# q2 ]( X
  33. #include <linux/mm.h>3 S% q& G& d( c2 c
  34. #include <linux/dma-mapping.h>
    " S8 b$ a3 a: }

  35. 6 ]6 e$ i# f. Q( H' Z0 Z' B
  36. #include <mach/memory.h>
    / Y) U$ b8 M: ?) y9 u8 @  T
  37. #include <mach/hardware.h>7 Z8 e( T. L7 a, U$ `
  38. #include <mach/irqs.h>, J! J' o5 I- N+ o) w, {: v" h+ ~8 o
  39. #include <asm/hardware/edma.h>' [8 [& |6 L' t; D9 [

  40.   Q9 A0 T/ W) _3 Z% ^3 R
  41. #undef EDMA3_DEBUG! H1 N( y2 [# U' z
  42. /*#define EDMA3_DEBUG*/1 A, c0 H- L9 A0 t& t
  43. - c7 q: I3 T4 t+ a' \4 U
  44. #ifdef EDMA3_DEBUG* i! F' H- ^; J  M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), f5 @4 M0 B+ J! h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' A) D8 K- M0 v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( P; w" H; g- S3 J, A+ n, }
  48. #else
    " V+ d7 q% r9 m9 Q) Z5 _
  49. #define DMA_PRINTK( x... )
    3 |& F& Z* L. I* R/ \. d
  50. #define DMA_FN_IN
    0 Q" |( `. E4 J. x
  51. #define DMA_FN_OUT5 G% V# ^4 N' a8 n2 K, \3 W
  52. #endif
    ! @. ~3 A, J' x; F  y2 f# n3 {
  53. 9 w$ I" v. y9 V, L% |2 L* r$ F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 a6 m  Y- W  ^; J# a
  55. #define STATIC_SHIFT                39 j: @. `7 ]# U  Q
  56. #define TCINTEN_SHIFT               20/ e/ B" u4 H9 y) u. h" r/ f
  57. #define ITCINTEN_SHIFT              21
    $ r9 D9 N. W0 R! X1 k
  58. #define TCCHEN_SHIFT                22
    1 W& m; Q% S! P6 a
  59. #define ITCCHEN_SHIFT               23* l% I) ~+ S5 {/ c! J" [
  60. 8 ^8 U' b# r* F5 h. x7 n# x% H; E
  61. static volatile int irqraised1 = 0;
    ) H- y5 a1 p1 q% p4 A
  62. static volatile int irqraised2 = 0;5 L0 b1 m" B8 w4 f

  63. " {8 g6 I1 T7 l% E( R4 K( J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 z' Z' {: f8 Q5 o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! B- ]4 m# |" M4 ~& M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : J4 E: B2 W3 d$ z) D6 l% u

  67. . H! `- c3 y9 `1 s7 T  m$ o; h
  68. dma_addr_t dmaphyssrc1 = 0;
    & U: v- f5 ]1 ?& S7 _' {! q. o
  69. dma_addr_t dmaphyssrc2 = 0;3 _6 J! h7 U; F0 j' H
  70. dma_addr_t dmaphysdest1 = 0;
    ( \4 N8 m/ E1 B6 k' O6 W
  71. dma_addr_t dmaphysdest2 = 0;8 W, |# ^( i* ]2 w3 o: T

  72.   }, i+ q( V8 o  O5 v  \
  73. char *dmabufsrc1 = NULL;
    * D( `' O/ {$ H1 `2 I
  74. char *dmabufsrc2 = NULL;. N& u* s: z3 `. b! m3 C4 R* D
  75. char *dmabufdest1 = NULL;% O4 A+ v/ c5 p
  76. char *dmabufdest2 = NULL;
    $ E& ^4 L3 D0 _6 }

  77. # }% L3 j( M, K* k5 [# T
  78. static int acnt = 512;+ n% G, M2 R0 a8 D) V
  79. static int bcnt = 8;, B. X* r0 ^6 M) Y3 f
  80. static int ccnt = 8;
    9 t! C) N6 S6 i  W$ `6 h
  81. 9 B/ @3 w( d* Z- n2 w" W( T
  82. module_param(acnt, int, S_IRUGO);
    * M% `. B$ {2 w
  83. module_param(bcnt, int, S_IRUGO);
    : O3 B, ]( x* M/ a8 ~0 @
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: t. J6 o% c/ A, E3 S4 h
2 S7 l( c2 n$ C! _7 [0 D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ }6 p4 f: [+ t' jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# N- F# ]6 i% B( r. I     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 s6 o. E2 a, _- K- x: s7 ]6 Z0 L1 c5 {& k8 N- R
* B# _$ u) @1 p- ?  a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-24 01:08 , Processed in 0.039214 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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