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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' G0 w" l# e7 [* D6 ^# V
  1. [code]EDMA sample test application6 m5 m% e( `* F3 o- L( _7 d% [" o- C
  2. /*
    : m- @: j; z5 u2 h* [) c
  3. * edma_test.c
    1 N$ R) j4 _+ }
  4. *) l- |* }! V! O$ G, ^
  5. * brief  EDMA3 Test Application
      M1 ~! E7 \; P9 ^1 a
  6. *. k. E" v$ l' Q! w# j4 c
  7. *   This file contains EDMA3 Test code.
    , n0 g  X( v2 r! U! @8 ^
  8. *
    0 V" F% ^& Q1 q; Q2 ?2 ^/ K/ m$ l- W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 a7 Y- \: z; g& X8 P+ j; ]4 [+ p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) [9 y4 b0 {" _4 u- Y+ p
  11. *         TO CHANGE.
    % }) S' T* N* U2 n  W1 m, h3 |! ~
  12. *
    7 w& S; ]; t# U* J$ S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! y6 a$ ~  C1 s2 F
  14. *, L; d- H! K. y6 F6 O
  15. * This program is free software; you can redistribute it and/or: }6 ^# g) x0 V4 S* A
  16. * modify it under the terms of the GNU General Public License as; h9 E3 v  t9 c3 J2 @
  17. * published by the Free Software Foundation version 2.
    9 U2 G0 R7 @2 H  J- {
  18. */ k! e! D/ V6 _1 e, _3 \7 c1 {  E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 E( @2 G, v) m. j
  20. * kind, whether express or implied; without even the implied warranty2 r/ K2 @: p3 Z/ C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 {2 L, G3 q7 m! O
  22. * GNU General Public License for more details.2 k/ g  K9 E+ \! M
  23. */. d: j4 |1 O- r' ^
  24. $ M0 [! p6 g( [8 Y9 [; [
  25. #include <linux/module.h>
    , p* d6 d+ Z' p0 y! k
  26. #include <linux/init.h>* C% l3 _+ @' M; y# G3 R& Z1 R
  27. #include <linux/errno.h>
    ( l% _3 W5 q& R8 L, U3 x1 {
  28. #include <linux/types.h>5 [; J) x* C& X  O2 \' y- c
  29. #include <linux/interrupt.h>  }" B9 R# y$ I' u7 y& u
  30. #include <asm/io.h>2 _! m* e4 K: |1 b9 H. c
  31. #include <linux/moduleparam.h>) j. c& ^# ?9 s/ P8 q
  32. #include <linux/sysctl.h>
      W% x! N% Q. K3 e; u# N
  33. #include <linux/mm.h>
    5 a. ]2 X) H2 {( C/ P) e8 q
  34. #include <linux/dma-mapping.h>
    $ `  L  y. V+ H+ Z9 z

  35. . }! C2 ^( m; A9 h+ w
  36. #include <mach/memory.h>
    # k$ Z5 R- e  y) V; {- q6 ^
  37. #include <mach/hardware.h>, ~* L# \4 I9 c2 u$ b" h* z
  38. #include <mach/irqs.h>. @) E! y/ t( S  n+ s( d3 R+ I
  39. #include <asm/hardware/edma.h>& T- c( x& g: h6 i
  40. + p4 z5 Z% O! H: r) m( d
  41. #undef EDMA3_DEBUG
    $ A5 U9 S- ~5 _! h& g; U( V
  42. /*#define EDMA3_DEBUG*/3 [- U2 V2 k8 S; K

  43. ) \+ \8 f, f! g2 p- z% i% n
  44. #ifdef EDMA3_DEBUG2 x* L" s  d: u5 j; y0 m8 E3 M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; w" G2 }( p' J: g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& U6 z4 x  L# O9 u6 E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; y( I/ E: E- @1 w
  48. #else) i3 c3 M, W2 F0 X" }0 P
  49. #define DMA_PRINTK( x... )6 b! R4 J$ u+ j8 b; X9 H6 C6 t9 c
  50. #define DMA_FN_IN. c9 O) }) i1 X, H) }
  51. #define DMA_FN_OUT
    + `$ d5 t3 g; I) e
  52. #endif/ q* t6 i( P$ `# V
  53. . A4 q1 r3 c: l2 K- H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " b( W: p% P3 g/ @) _
  55. #define STATIC_SHIFT                3' e# ]: R* K3 ^" ]% v4 @- f
  56. #define TCINTEN_SHIFT               20) Q( l) s0 s! B! Z" Q. U: k
  57. #define ITCINTEN_SHIFT              21
    # _( p  O! j+ r0 Z
  58. #define TCCHEN_SHIFT                22$ _/ M5 F! b7 h& I- L: L' [
  59. #define ITCCHEN_SHIFT               23
    & I( r7 j( F7 }+ S% I

  60. 5 t8 W& |% T3 b4 A  G/ ?
  61. static volatile int irqraised1 = 0;
    # g# _; y* R% N+ L3 E
  62. static volatile int irqraised2 = 0;0 R/ U) \6 [* A

  63. ; h) `7 H8 |$ z" `0 {; n5 Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 [6 n8 G1 N1 u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: Z' a9 p/ s( M8 r- c4 X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( y, {- L' ^7 `! O; u) L/ e+ g

  67. 7 C2 G8 w  X. }) K
  68. dma_addr_t dmaphyssrc1 = 0;
    4 `$ n3 L* g- K: p' J3 j+ k
  69. dma_addr_t dmaphyssrc2 = 0;& o7 m' C1 J- S" n1 h
  70. dma_addr_t dmaphysdest1 = 0;4 S. J- B% e$ E
  71. dma_addr_t dmaphysdest2 = 0;9 W2 c2 T* ]8 b. {5 X
  72. " g; h: V0 G  R% Z2 `! [- ^" J
  73. char *dmabufsrc1 = NULL;4 O* f: m( u; o
  74. char *dmabufsrc2 = NULL;
    0 g3 x1 H: t( j# \2 a, o+ H
  75. char *dmabufdest1 = NULL;
    ; W5 m, q5 m. Z
  76. char *dmabufdest2 = NULL;; C  s8 N: |/ C" C- h$ L
  77. # T8 {/ G+ V5 ]% `* V9 p
  78. static int acnt = 512;. |% z* ?. T8 v+ p5 N( [
  79. static int bcnt = 8;
    0 G: S; I2 Y5 T( [
  80. static int ccnt = 8;2 m8 Y* n$ B6 m1 S

  81. % P/ s, T6 R4 _  _1 n; m
  82. module_param(acnt, int, S_IRUGO);& W. _0 I- k8 F' c
  83. module_param(bcnt, int, S_IRUGO);( ~7 r. Q' l. Y) z, V
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 i6 k$ q. {9 v" y; y( ^$ H' m
. j: d; b1 L0 p+ Q7 t3 B6 [% F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ L) \- ]+ Z" e; k6 P1 }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( O( |' A2 K2 \     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 ]  U, i3 a3 c. g$ F
$ g$ j& W( v- b5 Q' U$ h

$ Q! u; I( H. d* t* ~; O  `7 D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-22 05:58 , Processed in 0.035848 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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