OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " p( h- d$ Q4 u8 n
  1. [code]EDMA sample test application3 Y8 o( Y$ r' H, O( v9 C  z
  2. /*
    1 f* j6 Y6 L" U+ {
  3. * edma_test.c6 v% [$ V) p6 o# K
  4. *
    % v% F# z0 c" L+ [
  5. * brief  EDMA3 Test Application' d( P5 E, {6 U# x
  6. *
    0 \* k+ o+ R* e2 B$ d
  7. *   This file contains EDMA3 Test code.$ J" g0 o+ T( _+ {2 H, g1 G' a
  8. *
    " `& d6 X  q, |- P, Y0 w$ ~2 O/ Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! P- X- @3 T; ~7 s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 v% {5 T3 ]5 x' O3 G# U% ^; g
  11. *         TO CHANGE.
      ?( W& i% M% b) |2 O
  12. *
    $ K7 ]4 j! \* s& X( i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 k1 R  o6 s* k0 L$ N  ]8 {
  14. *
    ' R; t6 h2 x# p- k, J
  15. * This program is free software; you can redistribute it and/or) h# ?3 H. h- E+ Q' X$ N( T2 v
  16. * modify it under the terms of the GNU General Public License as
    8 K7 O2 {8 j6 f
  17. * published by the Free Software Foundation version 2.
    . F- i- r3 y/ m; [+ h/ s' \
  18. *
      l1 R' ]* a8 {* b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 D" D- I0 h4 T/ s7 X" g
  20. * kind, whether express or implied; without even the implied warranty- d/ \* p  {8 x% V+ |5 T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) G! a; Q. [6 L3 U1 E3 ^$ Z/ O1 R# _
  22. * GNU General Public License for more details.
    " g4 K. w: i- s( R
  23. */
    * G4 h. w: n& [  k) k
  24. # z9 D; ~! ^  Z* [- x% `2 w4 i
  25. #include <linux/module.h>, ?; g' |5 j& d3 I" L: ?. h
  26. #include <linux/init.h>9 C0 T. F& ]1 C  H& M8 q# f
  27. #include <linux/errno.h>
    ( T9 T: |$ c) w
  28. #include <linux/types.h>$ S8 u" q5 \( L8 w! T: O
  29. #include <linux/interrupt.h>
    * l6 E! X& d& a: _7 e$ }2 s
  30. #include <asm/io.h>: }5 R3 j, G# S8 R2 s* `& i. @
  31. #include <linux/moduleparam.h>& w# z' A6 U& e+ [0 d4 J
  32. #include <linux/sysctl.h>
    0 b. R+ F+ t: h' O1 S4 p" @& s* {5 Y
  33. #include <linux/mm.h>3 J8 q, d6 P$ r4 `$ S2 z( y, R9 D, C
  34. #include <linux/dma-mapping.h>$ a- L" a" v$ a' n

  35. - l# d: j! e$ l; J
  36. #include <mach/memory.h>. X& k# I+ A1 b/ ^
  37. #include <mach/hardware.h>% Y, u# K9 J9 ~* B( T4 ?
  38. #include <mach/irqs.h>; H& {2 D) u3 G9 P' v! K# \2 N
  39. #include <asm/hardware/edma.h>% Z3 l* R1 ^4 M( L# J+ F% T

  40. 3 a; _) i+ p2 q
  41. #undef EDMA3_DEBUG
    9 V( [$ p$ L7 |# m1 m, Q8 L
  42. /*#define EDMA3_DEBUG*/
    " Z# W$ v; @" k2 n
  43. 4 f0 P9 g2 n! ~) d5 n
  44. #ifdef EDMA3_DEBUG+ d5 H5 t& T+ [& Y2 \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; @- i, h# n# f6 e# m& A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* y# Q+ i5 J* M. }) t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 v6 l( x8 T6 o/ T8 x& @9 q  R8 [
  48. #else
    2 z8 M3 }: K1 ~2 ?
  49. #define DMA_PRINTK( x... )
    * d5 Y4 n5 W/ @5 q2 H' E$ J
  50. #define DMA_FN_IN
    # d  b9 E9 t1 R9 l
  51. #define DMA_FN_OUT6 V2 t: [2 V  J6 Q2 F7 J) T
  52. #endif
    6 [" P$ T2 B$ M( h

  53. ' n7 D3 C8 ^2 O' `# ]( H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); b6 ?, F' Q- F9 ~- l
  55. #define STATIC_SHIFT                3. h9 `( P1 t5 V! \. p8 N' i
  56. #define TCINTEN_SHIFT               209 e: k2 X+ f# ^! g, p  m& m3 i
  57. #define ITCINTEN_SHIFT              21' Q5 U: U. \9 X1 J. R0 e7 O) c
  58. #define TCCHEN_SHIFT                22
    9 i: g& I7 T; d. w" D& K
  59. #define ITCCHEN_SHIFT               23+ N. G- `# g8 l5 y

  60. 4 q+ l% h: ~- N! a7 H5 w0 q/ }
  61. static volatile int irqraised1 = 0;0 p7 B& z, p3 s# O
  62. static volatile int irqraised2 = 0;
      c- w+ c7 Z* B- r4 E, c& D' e

  63. + r+ k6 x; v5 G# f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ O! m/ e7 W$ r+ n2 V: i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " e# t: M/ z( q2 H' e/ R* u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * w) ?( A! o& w- q3 K6 s

  67. * I3 L9 C: h, N+ q" R9 P
  68. dma_addr_t dmaphyssrc1 = 0;1 z0 M) q% A6 K5 K
  69. dma_addr_t dmaphyssrc2 = 0;
    8 E  v  n  d2 l* H2 z9 R
  70. dma_addr_t dmaphysdest1 = 0;! P& ]4 Y% ]: e; C  M( J
  71. dma_addr_t dmaphysdest2 = 0;# p" ]2 }; |# E5 q6 h
  72. $ [( k  A. }  Z
  73. char *dmabufsrc1 = NULL;
    : N& _7 c( T2 D8 u7 B
  74. char *dmabufsrc2 = NULL;( q, s9 f! \- T
  75. char *dmabufdest1 = NULL;
    # |! ^0 Q3 D+ L
  76. char *dmabufdest2 = NULL;
    2 [4 q/ N) i5 m) C* O: J
  77. * c6 D0 l+ ~% o8 s  g' K
  78. static int acnt = 512;
    " S+ C4 v9 j1 C9 G" |1 C. o" r) E
  79. static int bcnt = 8;, |' W. H: \8 K) b* N! [
  80. static int ccnt = 8;" H: ~1 f7 I- p2 [
  81. ; A" `, S3 j2 o  A' h0 [
  82. module_param(acnt, int, S_IRUGO);
    8 I$ v' I  d1 a9 }, {4 {8 g, T
  83. module_param(bcnt, int, S_IRUGO);
    / ]* _; f" W' J5 b( L2 ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) Y5 w9 P1 l$ }7 I( O
  }8 B- {4 Z: z4 G3 K* _+ Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, t1 s2 {$ Y0 warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* \* p+ H1 k! M" n- j6 p1 m     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 a. l5 k) q# a6 Y) t9 D2 d+ \
( a* ^% P+ k5 }3 s2 e- `$ e( b7 I

. q- B: c, T2 O8 s) {1 L1 c3 ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-29 07:47 , Processed in 0.037965 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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