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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ r! i, J, x  L; `) G
  1. [code]EDMA sample test application6 f: v( O" W" a& a- `0 U: I' Z
  2. /*
    7 s% p3 X! ~" f6 R# u0 C2 o
  3. * edma_test.c
    2 C: H3 j; M( Z3 o; I3 b5 a! \7 j, Z
  4. *
    9 F% u( r" \& c
  5. * brief  EDMA3 Test Application
    9 Z5 k8 k2 R+ k  k) l) i4 i* R; N
  6. *
    6 X% m% J  h: d: F9 H$ W
  7. *   This file contains EDMA3 Test code.
    8 q" I/ W6 b0 }5 ]: x; o+ z- z$ E
  8. *8 G7 z% ~: q, e) O# [8 I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 G& _# p: _+ X3 c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 V: G% F, P9 Q% ~, I
  11. *         TO CHANGE.
    $ j. n% N* V# x9 y5 f# N3 K
  12. *6 c7 `; m9 ^, `; r. B* H4 I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 }# _% h. l. \, T
  14. *) T9 a+ _0 }% [) A
  15. * This program is free software; you can redistribute it and/or
    4 ^1 ^8 l# E( ^; `1 Z
  16. * modify it under the terms of the GNU General Public License as
    3 G6 E. M9 P* i! k9 k
  17. * published by the Free Software Foundation version 2.
    $ J: |1 z7 h' Y9 i. Z
  18. *5 Z7 S$ V$ [1 g0 E& {7 P. I/ ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - C) z7 _) ]8 W% n0 B
  20. * kind, whether express or implied; without even the implied warranty) b' D5 {& b! K' s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 {) |; M. e) V% n
  22. * GNU General Public License for more details.8 y8 t6 m' I, R8 ^1 @
  23. */
    ! i1 l% t0 G4 n; y

  24. 1 v: |: D8 z" I9 k0 G
  25. #include <linux/module.h>! j6 j' _4 U7 _$ y
  26. #include <linux/init.h>
    + J4 {. ~8 A+ p- \
  27. #include <linux/errno.h>
    " i0 S" S) d- {3 ?4 F5 v
  28. #include <linux/types.h>
    + ?  w( [3 Q" D$ J7 I6 k5 Y
  29. #include <linux/interrupt.h>
    5 I) w, p6 c- }& B6 \( [; X9 [
  30. #include <asm/io.h>+ F' f" C! n5 o6 d, f7 y2 n/ z9 B
  31. #include <linux/moduleparam.h>
    5 R* t8 F+ v7 U4 N/ Z$ u
  32. #include <linux/sysctl.h>
    4 i! X8 ]2 K5 O5 ^
  33. #include <linux/mm.h>  s8 X5 ?' g8 \' X* u/ v3 P* T* G% R
  34. #include <linux/dma-mapping.h>+ {9 f% g3 y9 [4 G

  35.   `# g" m5 O7 _" L# w% o2 h9 X" L
  36. #include <mach/memory.h>5 J* j- R4 Z" ~$ Y% O$ u
  37. #include <mach/hardware.h>
    " w1 r4 k. R" m7 {0 ^
  38. #include <mach/irqs.h>* r' z! B5 H/ o' N7 e/ n
  39. #include <asm/hardware/edma.h>
    2 f8 a0 d+ |3 ^6 ^; e

  40. # k* q. I2 j# [# P2 C- k
  41. #undef EDMA3_DEBUG$ C& m# Q3 ?: m. h1 m
  42. /*#define EDMA3_DEBUG*/7 h+ p3 W7 F  F( i" X

  43. # O; w# g1 }* f# f0 ?. S6 A
  44. #ifdef EDMA3_DEBUG
    ' D" e( S# H+ i- C- r2 o- G3 _8 c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 f2 z1 ^( A+ Z# O; C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! a: \9 H1 `3 b' J) ]5 ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; t5 ?0 H4 i3 L$ I( a+ e. y& t$ b3 V
  48. #else
    " t& {/ z7 D+ {
  49. #define DMA_PRINTK( x... )7 v# H$ l% e7 a  c$ C' c
  50. #define DMA_FN_IN& d8 b+ m- J' B5 f& d  i6 d
  51. #define DMA_FN_OUT, E. e0 ]' Z1 z1 x" Y9 [! n
  52. #endif
    . V- n  s. ?- o3 J. @. I

  53. 5 o" L; Q; h3 ?% X* \& V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! ~+ |( a( t! P. p+ z2 y& f
  55. #define STATIC_SHIFT                3
    + f  v1 u' ~, V2 l2 Z
  56. #define TCINTEN_SHIFT               203 @. U" {( l4 p+ B
  57. #define ITCINTEN_SHIFT              219 P. R+ m! y- a' c
  58. #define TCCHEN_SHIFT                228 ^: k! P* E- G8 N2 o! Z+ O
  59. #define ITCCHEN_SHIFT               23
    8 B% r* A0 R8 V, x( `8 S* v

  60. . J% d( [( N" U3 E) R/ }" y' I
  61. static volatile int irqraised1 = 0;& B3 y0 w4 y' q" F0 ?' f
  62. static volatile int irqraised2 = 0;
    4 _3 p5 l. W' f, ~* d" z! _6 k: a
  63. ! l$ A# B6 y  \, U1 E; {  Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 b. \. }' P6 v& y5 v1 [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! \: |, A( r8 _# e# F' h" {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 i+ k! ?. u: m3 o

  67. " b; [* @5 ^' m0 L1 ~
  68. dma_addr_t dmaphyssrc1 = 0;! v$ `7 I: E- K3 f
  69. dma_addr_t dmaphyssrc2 = 0;" C7 i4 P. }& n1 G/ A& m5 j
  70. dma_addr_t dmaphysdest1 = 0;
    + k" ]6 _: ?7 E: P( O7 N
  71. dma_addr_t dmaphysdest2 = 0;9 J8 ]' k1 R2 |  |' n+ y; W& _

  72. 9 c" J( f0 ?& t* m) O2 y& y
  73. char *dmabufsrc1 = NULL;
    & w7 N0 v- o5 E8 V  ?% b* c% {
  74. char *dmabufsrc2 = NULL;
    9 P2 n7 Q) b# \& W* K
  75. char *dmabufdest1 = NULL;6 P, c3 o$ A/ ?
  76. char *dmabufdest2 = NULL;8 q! ~  G! [' T* k# m0 m4 B
  77. $ x0 ~  ^0 M) m6 j
  78. static int acnt = 512;
    * g3 C& k  t+ _  f3 L8 Y* t
  79. static int bcnt = 8;
    8 o9 R" \# c3 |  Q6 V" x" V0 g, K
  80. static int ccnt = 8;1 ]9 s( z' p0 w* C& @& M( w3 z. n! ]
  81. 3 X* }" k& ~: L' N  k3 Y. n
  82. module_param(acnt, int, S_IRUGO);# H. |+ Y6 X( ~! }
  83. module_param(bcnt, int, S_IRUGO);
    2 M% m! `) ~( o0 T0 k
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( f" \7 l8 {4 H4 n
# @# g+ L1 ~& M! W
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* I" x9 e5 t9 E. B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; |; k6 V4 s" h6 D. @     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; Y7 J  J5 H% _# K2 D( n8 [

% V8 v' z9 W  Q
9 ?0 A- u% h& X* l% z& i. S' ~! C  c% e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 00:22 , Processed in 0.039457 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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