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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % D& B& z9 K+ [  f0 F) [* f# z
  1. [code]EDMA sample test application
    4 C$ G* ]( V: c/ {0 i0 e+ f. O& `
  2. /*
    6 n; ]8 B! d$ v/ D. J* R- A7 ^8 k3 n
  3. * edma_test.c' k/ \6 q5 P) L9 g, S" }! p+ q
  4. *
    & \. Y: ]' s* h, l% N
  5. * brief  EDMA3 Test Application+ t: W' W* \- B
  6. *7 w8 g+ h( S; A) [0 q
  7. *   This file contains EDMA3 Test code.
    4 [- S% C3 I$ ]8 H
  8. *
    , [0 U/ l1 u# U5 H# Q8 a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 w5 l  T7 p  i- H; f& G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 W8 }4 m$ \$ g1 \* {4 h
  11. *         TO CHANGE.
    7 @' r; E. _+ ]$ u+ B6 ~
  12. *, j: w. d2 E2 O& ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 |6 k! n7 a* ~6 A; R
  14. *
    4 D/ F% c6 L; r% }. D
  15. * This program is free software; you can redistribute it and/or8 A' v- Q# N6 a( Z& ^. A
  16. * modify it under the terms of the GNU General Public License as( W9 r3 H3 @% f" C6 v7 x
  17. * published by the Free Software Foundation version 2.
    7 @7 [1 i9 Q" l4 l
  18. *6 K0 y4 Z+ A* y) f: M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 T9 g2 G, s0 t" c
  20. * kind, whether express or implied; without even the implied warranty; R3 {3 ]% N5 x2 D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 f0 m1 |" V: h+ U; U" ]* u0 ^
  22. * GNU General Public License for more details.9 p- D) {" _) _  M/ t0 j
  23. */9 H5 {0 U1 X: A$ p% |
  24. ( j% _1 [; L4 L, a1 x
  25. #include <linux/module.h>5 y1 F3 T( D# B
  26. #include <linux/init.h>  u- H' Y6 W4 t( i& q" D1 U
  27. #include <linux/errno.h>2 ?8 A/ h- o" E* A' X# t. A5 r
  28. #include <linux/types.h>: x2 B* Q9 W) a) k1 G# m
  29. #include <linux/interrupt.h>
    ' R3 o* h( y  z. C9 Z$ e" B; \3 a
  30. #include <asm/io.h>6 Y0 x( k. h" l0 s; {
  31. #include <linux/moduleparam.h>
    * S3 D2 h# a1 Q* h+ G+ i6 H
  32. #include <linux/sysctl.h>& i7 S  \1 b, M9 Z" ~6 {
  33. #include <linux/mm.h>
    3 q: k& ?! s3 ~! ]
  34. #include <linux/dma-mapping.h>3 S7 [6 S: K2 u
  35. ) P4 Q8 D8 v' k8 O+ ]8 g2 H
  36. #include <mach/memory.h>
    . R, o! ?# Y; F4 H; i9 {7 |
  37. #include <mach/hardware.h>, B. Z8 T/ ^7 h# Z; r
  38. #include <mach/irqs.h>2 ?8 a. h# E# J* m3 `- L* y
  39. #include <asm/hardware/edma.h>
    # H# H' e) B  k9 H- }  l
  40. : g5 l% U! ~$ ?
  41. #undef EDMA3_DEBUG
    & o( v8 O% t- ?" F$ K
  42. /*#define EDMA3_DEBUG*/
    : F- c/ \: Z7 M: R8 L, r

  43.   @+ g3 @) Q# v
  44. #ifdef EDMA3_DEBUG  D7 V  g. M6 _6 V6 k+ x7 o& }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# P  M4 _. A0 L0 ?; ^0 x+ w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - K7 Y) O0 z9 u, _$ s2 S9 s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; F6 z+ [$ b% w* [, x
  48. #else# m. e( O% {7 j' w0 K) j8 I
  49. #define DMA_PRINTK( x... )
    8 e  v/ C9 A# i" g9 V
  50. #define DMA_FN_IN' q+ u5 c, W( l3 b" u, V' [$ }
  51. #define DMA_FN_OUT
    . b& E' _, N/ E/ c; X
  52. #endif
    ; k( q4 r. c, K0 B. v( s. N% Y
  53. # c+ d, C) r. x+ a6 f# O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 t1 P3 {# ^# z  }: O; R3 q
  55. #define STATIC_SHIFT                39 \; d/ X& v( K; J( ]
  56. #define TCINTEN_SHIFT               20  X, r, m4 I/ ]( K
  57. #define ITCINTEN_SHIFT              213 u, y$ \( L  z* |
  58. #define TCCHEN_SHIFT                22: U1 R8 D) d1 i4 N6 }, K5 _
  59. #define ITCCHEN_SHIFT               23
    8 i2 F9 o7 ^; i! A5 W1 d
  60. 9 B# ?3 X. |9 J. R
  61. static volatile int irqraised1 = 0;" h" c! d, ~" U+ w$ h
  62. static volatile int irqraised2 = 0;& _7 u. G7 E8 Y
  63. / j+ g+ K7 I. o  t+ _+ m! U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) v. F. f8 T5 \. v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / Z$ k9 k) i- Q2 j3 D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 m1 P# i% @8 G8 [6 V& c& Z( j

  67. ( i! M# c* m% ]
  68. dma_addr_t dmaphyssrc1 = 0;& y- [- f2 _/ E" W, \7 B( `8 E
  69. dma_addr_t dmaphyssrc2 = 0;- z, v" x7 a9 O6 u1 S
  70. dma_addr_t dmaphysdest1 = 0;
    ' _/ L9 W8 }' X- T6 r' Z+ |# s2 H
  71. dma_addr_t dmaphysdest2 = 0;7 L2 [  u$ Y' @# {1 M& }* n. T

  72. 2 T/ z( T+ u2 r+ R" Z: W
  73. char *dmabufsrc1 = NULL;" [& |/ w0 t2 V  a- {5 L& P& N& i& G
  74. char *dmabufsrc2 = NULL;
    6 x* X, s. M3 i; P0 e. o
  75. char *dmabufdest1 = NULL;' V. k- ]# K! P2 O8 T5 c2 x/ f8 e
  76. char *dmabufdest2 = NULL;2 _7 J2 X7 e, s) E9 M

  77. / C( h/ ?3 V0 D: \2 j" }
  78. static int acnt = 512;. V, N" ~/ w* q1 F# x
  79. static int bcnt = 8;+ K+ F: g0 E" Y5 L
  80. static int ccnt = 8;, o0 ?+ `% F1 @" S" O. O
  81. % Q: [1 w- `4 @
  82. module_param(acnt, int, S_IRUGO);3 g9 k8 [9 V- Z* Y' |* [0 o
  83. module_param(bcnt, int, S_IRUGO);# j, p- m1 [& a2 g4 ^$ {$ ~, T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: O* K( |- P" u. e# N
% c9 P0 \* v7 k- e      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" ?' B( Y! Q* \" t  varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 S  }% t8 f8 M# \% R6 m( X5 U
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 V! G0 @  L% C  y6 L
: O' d- e  H( M
7 ^3 d; Z4 a$ a. X, k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-27 09:21 , Processed in 0.041453 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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