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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 H& C, o( g& |3 k
  1. [code]EDMA sample test application7 T: u+ S7 O9 b3 h% K
  2. /*
    9 h) n! M7 |0 y
  3. * edma_test.c
    * Y( H8 j1 c; b' R$ @& k! H6 \" D( h1 [
  4. *
    4 G5 Y0 \! K1 \1 g* }( z7 _/ a
  5. * brief  EDMA3 Test Application. x3 K* S) C9 B
  6. *: q* Q  o5 o' B% G4 a5 F2 S/ G2 Q
  7. *   This file contains EDMA3 Test code.
    " R7 w* C7 |# g6 A4 {8 p
  8. *
    , v6 v; M8 V3 p- P" D# S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . {- M8 k9 @$ @: }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + O. E( G& O0 |( e$ _4 M
  11. *         TO CHANGE.6 x0 k1 \! p) f$ y& G4 b! ^
  12. */ A6 t, a! H: c0 q* u) y7 |6 n- H5 m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / T; }/ H& s3 Q$ z
  14. *
    $ S  z- @- D! [* S% V: D8 A
  15. * This program is free software; you can redistribute it and/or
    7 |9 y9 v. Z$ s* b) c$ p8 }
  16. * modify it under the terms of the GNU General Public License as
    5 U( e8 w* x# ^
  17. * published by the Free Software Foundation version 2.
    5 B9 \% f5 M) K# ~
  18. *
    : [3 ?0 B' K6 F" O# J* w: M* `1 o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / W/ {2 I% _- y; P) b; x
  20. * kind, whether express or implied; without even the implied warranty* D' s* u$ i1 |" I( i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 h% p9 h3 M9 s& w3 h
  22. * GNU General Public License for more details.4 e" V/ ^- r2 b- [& ^
  23. */
    ' c7 V- X. m  Y& H0 C: n
  24. , H6 ]* S0 d+ L7 O2 Y' N
  25. #include <linux/module.h>
    / a0 l  l, o' ~0 ?8 d! |( B0 J, t+ \
  26. #include <linux/init.h>; ^* r* W! t6 w0 q# ~3 U
  27. #include <linux/errno.h>
    : U4 H3 q* @. O+ E" D2 B: W
  28. #include <linux/types.h>8 M, z$ ^2 u  k6 A
  29. #include <linux/interrupt.h>; c2 Q( f1 w" D$ J% g9 h& ?
  30. #include <asm/io.h>1 L; R6 n$ D6 O# P. `0 }
  31. #include <linux/moduleparam.h>* \4 I$ r! F/ S9 j* V" ]( Y! K
  32. #include <linux/sysctl.h>! J; E( ~6 d! O% m
  33. #include <linux/mm.h>
    / L: |( M+ \+ q2 K6 c$ ~8 {: n
  34. #include <linux/dma-mapping.h>9 \, p  d5 u6 L& d9 m9 N, l

  35. 1 A8 y# e& @5 H0 F
  36. #include <mach/memory.h>4 J# h$ {; J4 }
  37. #include <mach/hardware.h>
    4 z9 T  I1 N" t& D* l
  38. #include <mach/irqs.h>' U& i* G' V7 X2 c
  39. #include <asm/hardware/edma.h>! w' W2 S0 I3 ~" W
  40. " |7 b/ K* y  W: D+ {
  41. #undef EDMA3_DEBUG
    0 B: X' {3 s: A+ M( \. C
  42. /*#define EDMA3_DEBUG*/+ R. _2 [' G( [* i! ?$ I! k  O

  43. 6 e4 ~+ J8 J. x" C0 \
  44. #ifdef EDMA3_DEBUG
    ! v; ^* y5 F6 T0 @* j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ K# q; c5 i6 J% a! i  \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 j* Z: L7 H2 p6 }* m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 h6 g4 W/ b3 W4 ~- p* `5 U
  48. #else
    : [" J5 u# K0 V
  49. #define DMA_PRINTK( x... )# j/ J# w2 g+ L9 ^5 V$ Y' V' |: s
  50. #define DMA_FN_IN$ s* }' V, z. i# Y* C: _4 s2 i
  51. #define DMA_FN_OUT$ d" [3 w0 y$ R+ s
  52. #endif% Q9 z. m+ k/ U& L( g

  53. 5 f1 l) }4 v+ h0 X* ^) [' Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * b- R7 m; W' v0 _9 \2 r
  55. #define STATIC_SHIFT                3' z) u2 |8 w8 K) k7 z
  56. #define TCINTEN_SHIFT               204 `  ^: @' B2 s8 I8 V$ u9 l
  57. #define ITCINTEN_SHIFT              21
    - g  Y. ~7 R# V1 r( W7 @" Z
  58. #define TCCHEN_SHIFT                228 g, l: D; R, }& `6 ^- C) w
  59. #define ITCCHEN_SHIFT               23
    6 B. _8 p& A& J/ F. K" d4 T' W/ q

  60. 9 C( S$ [9 L: e3 `0 c( h
  61. static volatile int irqraised1 = 0;
      Z) J5 z6 L3 K. y6 v* w; b
  62. static volatile int irqraised2 = 0;, u7 c# Z0 E  ^' ~! ]- s, L
  63. + u! N3 u& ?9 j3 t: k; W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 ^: f( ]' G" d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 h0 w* r/ v- Q# N8 f! B3 h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * y, A, F/ S7 U: K" U7 O
  67. ) Z) D! `# r& [
  68. dma_addr_t dmaphyssrc1 = 0;
    : G1 Y- {# o0 {4 W
  69. dma_addr_t dmaphyssrc2 = 0;) c" k1 T, Z; \! u; U  a7 T
  70. dma_addr_t dmaphysdest1 = 0;) u& R% d2 S4 r$ f% i" b# P
  71. dma_addr_t dmaphysdest2 = 0;
    6 T) s# T* j' q8 I& T7 E/ I9 P
  72. $ |9 i& c4 s9 C- V8 u/ k: z) H4 Z$ `" s
  73. char *dmabufsrc1 = NULL;
    : d4 Y! U7 X+ \+ B
  74. char *dmabufsrc2 = NULL;" \: V4 ~6 @. V% J. _# f$ j
  75. char *dmabufdest1 = NULL;
    $ a7 O6 Z+ b  @9 @% i
  76. char *dmabufdest2 = NULL;
    " D: f( T2 p4 C; A

  77. ' X8 f- H. \  ?7 K7 \8 M; i
  78. static int acnt = 512;
    ) s: ~0 o0 Q  B3 K0 z$ d/ N
  79. static int bcnt = 8;+ n/ \  }% p5 y. l  h
  80. static int ccnt = 8;
    8 I+ e# |( ?; S, D1 s* ?) R( t4 N
  81. # k: \- ^) P. v$ y% f! d) T6 g% k
  82. module_param(acnt, int, S_IRUGO);( Q) e7 q2 g* t
  83. module_param(bcnt, int, S_IRUGO);5 y5 z2 e/ D* ]  M* s6 l" M
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- N  R3 K; c0 Y7 z2 k
/ p' ]: D0 c5 U  T) R: l: M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 a- `: J2 w9 i- x8 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ E$ L' u, ?9 q2 k; a2 c1 B; B
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' i! ?8 W# x; N4 J1 e
- D8 a: F, k6 \5 a( T
! ^- z% i7 g+ h7 z0 i* H) D4 p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 18:24 , Processed in 0.039846 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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