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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & B4 h# y  o0 o0 N/ s
  1. [code]EDMA sample test application3 L" s! k! l" C4 J( y
  2. /*9 Q2 }% }, l4 D5 W; D* B1 \0 R8 h
  3. * edma_test.c
    6 g' |5 z) Z: U% |; y: N
  4. *
    * P8 d+ s$ b% k
  5. * brief  EDMA3 Test Application0 p7 F8 g7 z% e
  6. *
    % J% w- d( ]3 u; i
  7. *   This file contains EDMA3 Test code.
    + c( M& p1 k8 r) ~
  8. *
    3 U( C8 ^" q* [. X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ L; C9 G0 Z8 G" F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 s& e8 o" ^% r8 S5 O( g. D+ T3 ?
  11. *         TO CHANGE.7 V2 L% M- A5 }7 ]
  12. *
    - i4 G# Q! b- k$ m6 y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" x* B: W! k2 J9 G3 B  T
  14. *
    % \5 L  ~" P5 }
  15. * This program is free software; you can redistribute it and/or; \$ y' e/ f3 _
  16. * modify it under the terms of the GNU General Public License as
    / H& d" w+ P3 E$ n3 \
  17. * published by the Free Software Foundation version 2.$ e1 x' r3 b: E+ y7 p
  18. *
    $ I( x+ I- w( i' e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + O5 \& y# D$ b+ p/ g" n
  20. * kind, whether express or implied; without even the implied warranty
    $ @# {. q' V. `  }% O; ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' k( }' u4 D( V5 O, L, t6 U
  22. * GNU General Public License for more details.7 K* ]# B& Y5 b6 L9 L0 O
  23. */$ Z/ p8 M% O7 ]1 W
  24. 9 ?- _/ K! d! u
  25. #include <linux/module.h>
    2 L! {. D5 Y9 O: C: ?& U
  26. #include <linux/init.h>: y$ L3 O6 o! M. g8 R' Z4 N/ F$ t* J
  27. #include <linux/errno.h>: }; ?& z* z) u4 X% _1 e* g% E
  28. #include <linux/types.h>6 c9 E9 a, A, g3 G# p, F+ V5 {/ ?
  29. #include <linux/interrupt.h>
    ; O3 _8 X  a5 w2 c* m/ w/ K
  30. #include <asm/io.h>
    . Z( u* C" |( J2 `/ {1 [5 V4 ]
  31. #include <linux/moduleparam.h>
    # j7 w! p* H( e8 F2 ?+ A
  32. #include <linux/sysctl.h>
    ' m& N- o/ v, b/ p$ \
  33. #include <linux/mm.h>8 w: s1 Q: [  L7 w& s% N
  34. #include <linux/dma-mapping.h>* c- U; D3 Y# `6 `

  35. ( S4 F0 s6 B5 v! R
  36. #include <mach/memory.h>
    * J4 b3 T& X3 D! P7 x$ n; L% s4 ~. q
  37. #include <mach/hardware.h>
    1 ]# n0 n& v% e$ ]# k0 J- z) F
  38. #include <mach/irqs.h>' q% Y; Z0 U  k& _3 H& {$ C
  39. #include <asm/hardware/edma.h>& T4 m. H/ ?9 m0 _
  40. * Y& }  V4 O% Q) ?' X. F8 w
  41. #undef EDMA3_DEBUG# P" D2 ]. F# S( g5 ^% w7 O
  42. /*#define EDMA3_DEBUG*/! Z" d, ~, j6 K. l/ N. `

  43. 8 c8 p; I2 E# a% I  l$ R
  44. #ifdef EDMA3_DEBUG
    3 V& Q+ U2 m2 R1 e+ l2 M" O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  {# a; x  S* \: e& E' `7 w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 S0 Y3 ?, C7 L- `6 A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + ]; r# `3 A7 E* O
  48. #else
    ; m6 m# [. w! x4 ]+ L. W
  49. #define DMA_PRINTK( x... )- t2 e, k3 W# ^1 ^' J# Y
  50. #define DMA_FN_IN! q; o# U) C) s0 N; p
  51. #define DMA_FN_OUT
    8 W* |+ |5 e& @/ n0 S
  52. #endif
    , a2 L- n" p3 q+ V( u

  53. # `) e- M- u: Q) l9 x' V/ @7 E5 o3 @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + y! k% J8 f' T4 c, \/ l3 S
  55. #define STATIC_SHIFT                3* N9 l5 k( O: K) Y' B' h
  56. #define TCINTEN_SHIFT               20
    9 q, h. W1 ?. z( d! J2 d
  57. #define ITCINTEN_SHIFT              21
    8 V2 C. q3 ?. j- m: T1 `
  58. #define TCCHEN_SHIFT                22) C  G& P. p+ e/ t$ s
  59. #define ITCCHEN_SHIFT               23
    " W5 ]2 Z; a! c% E# d

  60. 7 o; g! R4 M& O8 A6 n
  61. static volatile int irqraised1 = 0;
    8 I0 ?. x; l/ ^2 }% R0 ~1 L
  62. static volatile int irqraised2 = 0;
    2 d9 B: h; ^  ?+ X9 T
  63. & {: }. ^$ b9 E1 E- _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& _: x8 f( ~0 [  Z3 L: m" w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 {, Y: @1 p" }8 e  b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 K. Z- ~) B- B. S1 k
  67. % N" c" o$ \( u
  68. dma_addr_t dmaphyssrc1 = 0;
    8 x% s1 G1 t) {+ {# q9 w
  69. dma_addr_t dmaphyssrc2 = 0;2 D+ o" ]* v. F( D
  70. dma_addr_t dmaphysdest1 = 0;+ D, d! M7 t8 }+ R
  71. dma_addr_t dmaphysdest2 = 0;
    9 R: A$ W! w# {; o2 f

  72. . R8 U2 o) W% I% j; D1 \. `+ p" X/ h) \% m
  73. char *dmabufsrc1 = NULL;0 s9 i- ~- ~! W  G0 w
  74. char *dmabufsrc2 = NULL;, N* F. l" b6 |
  75. char *dmabufdest1 = NULL;
    - r. {5 q( Q0 I7 a) I5 F9 q
  76. char *dmabufdest2 = NULL;, m0 ]+ g6 v4 Y

  77. ( p* `! k9 t: v& _; o
  78. static int acnt = 512;
    ' |( T1 D9 k5 F  x0 b9 D3 `: M
  79. static int bcnt = 8;
    : ^4 m: t, i& g' `+ D& X" X5 Z
  80. static int ccnt = 8;
    & N( k) b4 `& r5 v) x" k! G# X
  81. / ]7 q# V5 i1 v; D: g4 V
  82. module_param(acnt, int, S_IRUGO);2 h) J9 [+ t! |/ ]
  83. module_param(bcnt, int, S_IRUGO);% y' {0 u0 ^8 d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 ]2 v/ M$ V( b5 Z( j/ U, b, r' g3 M1 p# v7 e( e2 `
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" y) ^5 F1 E$ R5 w: e+ d, |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 R, n6 @3 g) }     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) W, ~7 z4 q0 z9 b5 w
0 a2 `0 L! N7 `+ p* ~" H8 |! R% z+ X9 o, G
" P( r/ a+ B7 K3 w; `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-15 20:51 , Processed in 0.039217 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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