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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 z0 ^$ f4 {; D  _4 g9 |
  1. [code]EDMA sample test application( w. K* \$ m. x% K4 K( B+ X
  2. /*
    ( ^$ ?% ^6 f3 g( ~" j6 L4 m
  3. * edma_test.c& |! n' w3 {. d1 L4 J7 p: V
  4. *
    2 J5 R& _$ }8 a5 j+ _% a
  5. * brief  EDMA3 Test Application
      K2 @' }/ o" j% d) @
  6. *6 h; Q; U6 Z5 L- s5 s
  7. *   This file contains EDMA3 Test code.1 n7 O. ~3 j: D3 H) F$ f" ?3 ~* ?& O/ `
  8. *
    4 @" y! }9 x: n2 d' Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ _! m6 q9 G& w0 G- ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 w; X6 w: ^3 E: d; a; l9 {) P
  11. *         TO CHANGE.# ^- d% o0 ^9 I  h  ?
  12. *
    / x( S9 s2 g1 M( p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % k) M# S* P" _
  14. *' H) O2 v* z1 G6 G
  15. * This program is free software; you can redistribute it and/or
    4 ^7 i, t4 z1 _6 a
  16. * modify it under the terms of the GNU General Public License as# z0 j- E9 h0 c
  17. * published by the Free Software Foundation version 2.; W+ L8 ?( Z/ }8 n' g/ o: p
  18. *
      T6 _, i+ S+ v  }" @+ S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & _6 s9 W1 o% T6 y
  20. * kind, whether express or implied; without even the implied warranty" B" t, b7 s; H8 z0 c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; H. G  k  D/ P$ ~1 E, x
  22. * GNU General Public License for more details.7 N0 `* s0 n1 l
  23. */1 C& y$ a0 }9 n
  24. ' N0 g, O; Q$ O: Z1 |7 Y  S) K' \
  25. #include <linux/module.h>
    $ {+ p' d" z+ P/ }/ E
  26. #include <linux/init.h>* Y, h3 ]0 w5 W; Y$ V# k
  27. #include <linux/errno.h>
    ' M) M3 B- j, [  U
  28. #include <linux/types.h>8 r! P9 L6 Z& [, G9 n# L
  29. #include <linux/interrupt.h>
    : z6 @/ J. j# F* Z& O& v
  30. #include <asm/io.h>- _2 J0 V$ g+ t0 z$ }+ i  g6 u, M2 m  k
  31. #include <linux/moduleparam.h>
      M( E: b7 o# t: M, w& n
  32. #include <linux/sysctl.h>
    $ u, S6 R+ D6 M( @7 p$ ~2 P
  33. #include <linux/mm.h>
    + {2 w4 B# m# A& U
  34. #include <linux/dma-mapping.h>! O: k2 d1 l* I& Z, m# o* Z$ i7 X

  35. ' s- I0 {, e% x, U2 v
  36. #include <mach/memory.h>) u8 D+ X3 {) ~
  37. #include <mach/hardware.h>6 P( P% Z* b9 s! L
  38. #include <mach/irqs.h>
    5 S9 X1 s: x' C* F$ ]0 A
  39. #include <asm/hardware/edma.h>0 n6 P/ ]2 t! i, Q+ @
  40. : B7 z5 G& N8 k+ T9 G. j
  41. #undef EDMA3_DEBUG
    9 G# v( ~! `6 Q
  42. /*#define EDMA3_DEBUG*/
    2 Q  A: c( t6 s; e' \
  43. * M8 y: E" B( Q  Z/ W: }
  44. #ifdef EDMA3_DEBUG+ R* V, j6 @' b3 B! \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' V- a, z. s+ [: P: d& L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 o6 x, D2 g  \6 t/ Q( N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % z, c# t& \  @, `! D
  48. #else! O% T# v1 O! T! i# U5 V
  49. #define DMA_PRINTK( x... )
    ; Y" i( W8 F$ e! h  }) ]' Q( i2 _
  50. #define DMA_FN_IN& h3 W; R" k) B. U8 w" j
  51. #define DMA_FN_OUT
    " O2 W; k/ i6 |( p  `  w8 [7 y
  52. #endif6 a: i& U! `. \1 E  w. J6 n
  53. ; |9 x3 S& t& J: D* ~" ?! z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ z  N& h1 y9 ~( R3 H4 S( m$ W0 E4 B
  55. #define STATIC_SHIFT                3. y- c) k, U( X. t# u
  56. #define TCINTEN_SHIFT               20! t  h" m/ Z# f, K2 B. A! k; C) z
  57. #define ITCINTEN_SHIFT              21. p& M/ _- d7 k+ n& ]
  58. #define TCCHEN_SHIFT                22
    " w5 X4 k, ]( d$ j7 }9 q
  59. #define ITCCHEN_SHIFT               23+ ^5 o* ?0 i' B" d8 d& H
  60. ( t* d4 y! q* b9 T4 j; L( b
  61. static volatile int irqraised1 = 0;+ e% u! [( H! ]2 X% [$ X
  62. static volatile int irqraised2 = 0;, n; _% y& e7 B8 u
  63. ! w# z) @3 E3 g8 B; c! ~  v9 F: X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ Y. J9 g9 y2 w3 Y2 }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & Z2 X7 m+ i# E5 A' m  A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 `) e' W' b2 e

  67. ; k! W; K" m" V! Z
  68. dma_addr_t dmaphyssrc1 = 0;) R. r  L, p  S! N3 ?9 ?+ E5 M
  69. dma_addr_t dmaphyssrc2 = 0;# ]: O1 @5 x( a! M9 |  \) d6 w
  70. dma_addr_t dmaphysdest1 = 0;
    1 i3 O0 p* x# b: E4 {, t+ @$ \; W
  71. dma_addr_t dmaphysdest2 = 0;
    $ @' r) O/ W: s# q8 D: o

  72. ' {7 U! _/ u( _
  73. char *dmabufsrc1 = NULL;" |4 h6 w- q2 f# k
  74. char *dmabufsrc2 = NULL;1 k6 n- t7 M1 M  H' [) I
  75. char *dmabufdest1 = NULL;
    4 n6 X3 l5 f9 Q: J+ c( D9 j- g  W
  76. char *dmabufdest2 = NULL;
    * m5 L: v* L: q
  77. 0 ^% g9 r  M7 h
  78. static int acnt = 512;0 \3 I0 Y! Y/ K* p' @
  79. static int bcnt = 8;
      h  ?  u1 A1 N; z1 n+ f6 w
  80. static int ccnt = 8;  [& |* q# {# W) g  z5 R) N

  81. " T; g4 K! ^( }  z* X0 O9 {2 I
  82. module_param(acnt, int, S_IRUGO);
    ' I8 p  f! U1 P9 ^; u0 E" ]1 b
  83. module_param(bcnt, int, S_IRUGO);' W6 y  }/ d1 M0 x* r5 K. q- \
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ Z1 `5 I2 z; K1 m9 z* Z2 a, I. g
$ z; {1 [  e) Z0 n" c$ w/ L
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- X, k5 }. x6 q* R' yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) [% i- A# a+ L) P8 l
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( D4 _! T  H# \
/ o2 R4 Y) E5 Y; ^4 Z
6 i9 h% n6 Y! U/ S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-22 06:34 , Processed in 0.038996 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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