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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) ]. W. ^3 b% Y' ?6 R
  1. [code]EDMA sample test application
    % Y8 `9 H1 }6 U# g& ~7 S' _2 E: {
  2. /*8 t8 b% D: S% V' K' w
  3. * edma_test.c+ `: J' b+ K+ ?. {9 W$ j: a6 c2 G
  4. *
    2 N& E2 N) K, j
  5. * brief  EDMA3 Test Application% V& K3 V  O4 P9 H" |
  6. *
    2 T2 P6 V/ s; w' e+ }$ c
  7. *   This file contains EDMA3 Test code.1 o  x: ~8 D+ c0 U8 b6 H
  8. *0 n  f, B5 u% e0 \2 J6 c. ~* K5 V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; c3 }! K# ~" ]8 {- e: Y$ r# L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 J, v( h' X% }- V
  11. *         TO CHANGE.* W# T( `9 s. a  s
  12. *# @: {0 k- y5 o' ^& @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, x9 t+ w) D/ {
  14. *
    - N& {: i) S8 Z# x( ^3 X
  15. * This program is free software; you can redistribute it and/or. U! }7 [. n3 ?0 U1 C# f  ^4 C
  16. * modify it under the terms of the GNU General Public License as* x0 {9 j: x: v! c, Q+ N4 |
  17. * published by the Free Software Foundation version 2." u6 m; a0 @7 W: T; m' t: W
  18. *' [5 |, a# Y1 Q( z6 I2 ~. f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 B" p$ r3 k5 e) U# u
  20. * kind, whether express or implied; without even the implied warranty) m9 x0 I7 I3 f7 r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 w" j6 ~$ q0 k' m
  22. * GNU General Public License for more details.9 c; B9 J3 }) U* P7 Q
  23. */
    $ R" m3 O: l7 r2 Q# L

  24. $ F; T( K  A% K4 N, R& k
  25. #include <linux/module.h>/ t7 w7 R9 s( u. }
  26. #include <linux/init.h>
    + D( _0 a0 H: L; M
  27. #include <linux/errno.h>( [2 B4 O3 H$ H& u& {# P
  28. #include <linux/types.h>- W5 x+ h% W+ U! e8 J
  29. #include <linux/interrupt.h>
    8 g- D0 d; i- o* Q" ]' d) [- W
  30. #include <asm/io.h>5 E/ ~$ \& T- d" e
  31. #include <linux/moduleparam.h>
    ( [" v! W1 v4 [
  32. #include <linux/sysctl.h>& |6 N9 f; i8 Q: ]" S. T
  33. #include <linux/mm.h>" D- b. `4 N" y  M' d
  34. #include <linux/dma-mapping.h>2 x& y/ t, o- W/ ]/ s
  35. : d, I8 G9 a0 G2 }3 Q" `+ ?9 q
  36. #include <mach/memory.h>: N1 O+ R" P  b/ z6 z0 K# m
  37. #include <mach/hardware.h>
    ; T( m0 T$ B2 Z1 @% o0 M* P
  38. #include <mach/irqs.h>7 x0 e; @5 }' w8 b% T* j
  39. #include <asm/hardware/edma.h>2 t: y8 J$ I! d$ `$ Z# b+ o( J8 k/ ]( r
  40. 0 ?9 u( e( g3 v( O5 I
  41. #undef EDMA3_DEBUG& P; s  k- q, y' _7 t
  42. /*#define EDMA3_DEBUG*/5 K+ _8 A7 k% l1 j
  43. * a) g5 R. H* Z( U" x1 k" [
  44. #ifdef EDMA3_DEBUG
      S/ {5 {% ~* @( \7 x9 M! }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% Z4 H! F0 C, l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 A6 ?% z! y$ P' E( O4 L7 a( C- G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      q! c9 f' W3 ~: c
  48. #else
    8 s4 f* f! y4 ]4 ~; h# j. d; V( h; D
  49. #define DMA_PRINTK( x... )
    . ^0 p9 u/ |# x9 h+ c2 n
  50. #define DMA_FN_IN$ T2 j: S! h. v- P# W, A
  51. #define DMA_FN_OUT; `. y- E% D( O- P' k
  52. #endif
    6 E4 u- y/ _: E0 i3 c; v

  53. & e+ W) H& T' g7 D8 |- e& K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 [# S0 ?; I2 t6 G# v
  55. #define STATIC_SHIFT                3; M+ l. M5 u* ^7 [, d" f) D; J
  56. #define TCINTEN_SHIFT               206 T( T# `7 M2 D; h' R+ F/ ~. m
  57. #define ITCINTEN_SHIFT              21
    . Z9 o% p8 E  U2 t  A+ K% k% ^
  58. #define TCCHEN_SHIFT                22
    ) m$ k" ^, ]1 g/ a* z
  59. #define ITCCHEN_SHIFT               238 M. |/ N4 f0 n# p! z4 |" u& g+ P
  60.   A5 H: v8 k5 I7 j& P( d
  61. static volatile int irqraised1 = 0;0 @) O5 d" M  G& i
  62. static volatile int irqraised2 = 0;
    " h. @; S: Z3 k( Y0 d
  63. " O7 s5 \( r; S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / C# c( s1 [  R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 V& g9 X+ x0 m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) r1 d9 N8 R9 K8 J- ^! s$ {: Z
  67. ' w$ g6 ]& i* q
  68. dma_addr_t dmaphyssrc1 = 0;
    $ h5 c/ N4 L( S' [6 T8 W5 e2 g) Q1 Y
  69. dma_addr_t dmaphyssrc2 = 0;5 z3 m2 i* H7 t; ?8 Z5 D7 @1 L! w
  70. dma_addr_t dmaphysdest1 = 0;
    - g/ M, j) f9 b# M, p
  71. dma_addr_t dmaphysdest2 = 0;% _7 w/ e8 R7 V

  72. ; d. U- f# Z* }4 a5 v
  73. char *dmabufsrc1 = NULL;: @/ O- r- ~: g
  74. char *dmabufsrc2 = NULL;: U2 e" X3 k/ ?# e0 z3 h* o
  75. char *dmabufdest1 = NULL;
    $ Q5 X# Z: z& V! e( }$ G
  76. char *dmabufdest2 = NULL;9 ]! G) U7 m7 ^8 {# M. N5 f
  77. 9 ^) l* |$ a1 U" N1 _
  78. static int acnt = 512;9 a) c7 {, D' X" X
  79. static int bcnt = 8;
    5 c4 |. ]. |& B: ~2 d2 t
  80. static int ccnt = 8;
    . t3 _9 w% y& y

  81. $ ^; }: t( t" @6 Q& v/ G  k4 Q
  82. module_param(acnt, int, S_IRUGO);
    ' J0 b) ^% I* C* N/ {
  83. module_param(bcnt, int, S_IRUGO);
    ( X. K- g1 A, `8 N
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) l4 M1 @+ D5 u$ E

/ d* f- ?" G0 C      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; ^8 q5 V/ u6 Y+ e, A( G' b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( `' r3 e- Y  D7 R2 |# O$ r     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( J$ U. s$ s0 [3 o. q
/ b4 ~" O, V- ]8 T
5 B7 ?3 x- n# F6 P. R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-17 20:18 , Processed in 0.039422 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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