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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " w- t5 G6 Z9 r7 `6 j% O, \
  1. [code]EDMA sample test application% y/ r% v$ ?3 l( T4 V1 {
  2. /*
    ) _6 F: w) Q- I4 I
  3. * edma_test.c( F! X3 [2 k' X
  4. *, B* W3 f* D9 |. |+ A  O. c
  5. * brief  EDMA3 Test Application
    7 A/ P# }% o' k- @% }9 {
  6. *5 s( J' D/ L, e  a, I2 [0 h
  7. *   This file contains EDMA3 Test code.- a) m+ ^# s! V3 T# b( r8 X# H' a
  8. ** K$ T; R8 S& U* _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( O/ ^0 F4 V) [7 \5 E% Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 B( C7 ^) [( p% b$ A6 O  u
  11. *         TO CHANGE.1 \7 S& L3 p$ E/ Q8 R! Z: r
  12. *
    1 c# I+ t! B2 E  U; O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 o; X) y2 F: t$ e' U# [
  14. *2 y+ F3 q6 G+ [/ p
  15. * This program is free software; you can redistribute it and/or0 S+ E6 ~2 J/ }1 R
  16. * modify it under the terms of the GNU General Public License as
    * M7 R5 b. E) `4 [; ?, N
  17. * published by the Free Software Foundation version 2.
    3 J7 S8 I" j4 ?5 G: F5 X& |
  18. *
    0 ^5 ]% t% _& d; l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' \  J3 R6 A* u, z3 W4 h
  20. * kind, whether express or implied; without even the implied warranty( k% L3 N. A; f) w! A' S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      z6 H5 u9 W1 s
  22. * GNU General Public License for more details.  A6 p- @& w, [' A
  23. */  s) f" E  S. ~$ x  O1 u

  24. ( _0 ~' r! z, F0 s5 \0 ^
  25. #include <linux/module.h>
    ( O( m) p; u) [
  26. #include <linux/init.h>9 B) k& N" a! V- m& s9 A# r! g
  27. #include <linux/errno.h>
      ~0 e7 I, v. O' m6 _
  28. #include <linux/types.h>+ x% I% {) O. {5 s' W
  29. #include <linux/interrupt.h>
    6 s! q9 ]+ s7 n/ ?) P+ k2 e
  30. #include <asm/io.h>
    ; O. O4 d* e3 M! ]
  31. #include <linux/moduleparam.h>
    $ l8 |) W2 }1 T( T
  32. #include <linux/sysctl.h>
    ) x( ]7 ~- [. h  i6 C
  33. #include <linux/mm.h>
    , s+ `. L5 ]9 o8 o" O
  34. #include <linux/dma-mapping.h>% V* g5 N2 x) S4 M8 o( m

  35. & o% w1 O. }5 T
  36. #include <mach/memory.h>
    7 h# }. d& z8 o. k* L" y: @
  37. #include <mach/hardware.h># t: Q3 n( y$ t1 `
  38. #include <mach/irqs.h>  D+ }5 Y+ N( O5 O  ?
  39. #include <asm/hardware/edma.h>
    & k; P& h  o9 O" \. L: z# {  k4 t9 [
  40. & s# y% ^, |0 `
  41. #undef EDMA3_DEBUG, Z) @% A% {/ }  M, A' E
  42. /*#define EDMA3_DEBUG*/
    $ t9 \0 L& C) f  d/ R
  43. % D. f) P" D4 i6 K
  44. #ifdef EDMA3_DEBUG% L4 f* V) R9 b( R- a. l7 N' z# u6 E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). G. \2 V0 Z5 V- g: _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( P! S( ?. f4 K7 ~! i1 s  W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ [+ s; N9 I3 z0 [6 u
  48. #else
    + G2 @* n9 E  q$ S1 a1 k
  49. #define DMA_PRINTK( x... )3 L% s# {$ Z- h  C
  50. #define DMA_FN_IN; |5 f: N  m  a* c
  51. #define DMA_FN_OUT) m% b( T9 r7 ?3 @! g# I* C9 U
  52. #endif, j( r# g* f- y4 t8 L2 W" B. q
  53. 7 r- ^' W4 `" n8 B' |' J. [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) C& g- N2 l& Z( o7 D* \& }7 I
  55. #define STATIC_SHIFT                3
    ! M) O; ^/ b( Y  a
  56. #define TCINTEN_SHIFT               20
    # n: e" N. F3 O8 L; j
  57. #define ITCINTEN_SHIFT              21  d1 P: H+ V7 i8 w
  58. #define TCCHEN_SHIFT                22
    8 n4 b# ^( \% o* o1 [) P7 _7 l  U
  59. #define ITCCHEN_SHIFT               23
    + p. e- Q- I' `+ {$ v. p, \

  60. $ t- [3 h& [: ]& v3 V: z/ s5 C
  61. static volatile int irqraised1 = 0;
    % E4 O2 O, I5 D% V, I+ f3 k2 B( D
  62. static volatile int irqraised2 = 0;
    ( J# k( K4 N6 E! e/ [( L
  63. 7 E- @5 c6 [" a4 A, Q* ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + n) F9 |- Z1 ?; a1 o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / l3 ~2 Z' z9 ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- T' R0 d, U" C0 H7 i- j0 n
  67. 6 Z* ^7 n: Q* w: W7 U
  68. dma_addr_t dmaphyssrc1 = 0;
    3 [! l' ]4 _) @2 n9 r0 ~
  69. dma_addr_t dmaphyssrc2 = 0;6 |9 Q3 X* ^3 c- u6 i+ j( j
  70. dma_addr_t dmaphysdest1 = 0;
    7 N- W5 Z. X/ u, O6 g: B6 {
  71. dma_addr_t dmaphysdest2 = 0;+ k' r. |: R7 [2 q9 [( C
  72. * c8 u. e1 z: I! [% y
  73. char *dmabufsrc1 = NULL;! H2 [+ P" U/ I) \0 X4 k
  74. char *dmabufsrc2 = NULL;
    . h+ ~# U) R  \! K7 W
  75. char *dmabufdest1 = NULL;9 w& [4 V# n  |3 c) `) Y
  76. char *dmabufdest2 = NULL;! T; Y9 }& {  k: l
  77. " K4 N; p: V! U; s
  78. static int acnt = 512;9 E( `$ t' |1 B6 r2 h# N
  79. static int bcnt = 8;! m7 X8 }8 c( p0 P: S1 n# p
  80. static int ccnt = 8;
    ) f% {# @; |, k

  81. 9 o; H. {+ [) T8 p% G0 d# Q
  82. module_param(acnt, int, S_IRUGO);
    4 }( w3 S5 x) ?  S6 F
  83. module_param(bcnt, int, S_IRUGO);5 B1 z2 }- e; @
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: w/ o1 ]) ?4 J" S" p) \$ [
* [! R; g1 ^# e/ v7 D& Y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% u6 I+ e* H$ n% k9 w
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 R' b$ A: ~" G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 u2 G1 R* ?% K4 N0 ?8 `: Q
$ l! L+ h' T: d$ Z2 R1 C+ q

- P; B* [/ Q7 b$ j* [9 r+ q$ P  o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-23 04:19 , Processed in 0.045888 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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