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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 S; y: \  g$ d0 ]( [) S* h
  1. [code]EDMA sample test application
    6 I$ c4 S7 l- F! N
  2. /*& @  t6 v' H6 ~6 j9 Q/ ]+ G
  3. * edma_test.c; D1 A8 q1 V7 [# y; J) E
  4. *
    6 E( H0 Z6 L# E3 h7 l+ A, a
  5. * brief  EDMA3 Test Application/ J  v  [- H4 ^# Q4 G1 B2 x6 Y4 H8 c
  6. */ M: F' }6 [- @
  7. *   This file contains EDMA3 Test code.
    3 d# v( S. S' U7 o' {9 C8 v
  8. *
    : ~1 d" F2 T9 [9 ]/ ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % t# [3 i( a  X+ n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 w/ F& W% s5 @, J4 x
  11. *         TO CHANGE.
    ; }$ k% m, q, I2 B, e
  12. *
    & ^: z1 T, `& U9 y) H2 g3 `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 |: K. J- q/ p. t- N
  14. *6 o1 v6 @9 [; O% R4 o0 Z8 [) z! b# K, `
  15. * This program is free software; you can redistribute it and/or
    # F2 ?3 Q. `9 I) v
  16. * modify it under the terms of the GNU General Public License as. ~, c' i1 o- j; {- Q/ n$ m
  17. * published by the Free Software Foundation version 2.' N* U' @2 A6 i  J0 \# }+ D
  18. *: u: c( ?/ m4 q; Y, o2 s. j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' P2 r5 l9 ^$ D9 n* k
  20. * kind, whether express or implied; without even the implied warranty4 C! e9 G9 v3 ?8 W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- L7 O3 D0 n5 t$ z* |, ^
  22. * GNU General Public License for more details.
    3 B2 }9 Z: j- y2 B
  23. */
    ! Q, d) K" X7 _: S$ f2 S6 ]# A
  24. ) l. R% P2 Y* Z8 u
  25. #include <linux/module.h>
    - H7 y8 o8 M0 h6 n+ W. M
  26. #include <linux/init.h>
    ) J/ H; p: k0 g- M8 x! [
  27. #include <linux/errno.h>6 Z4 K. t# s+ m* z+ R* b3 _
  28. #include <linux/types.h>
    , }6 i8 s: A( g" t3 v& G7 l8 G8 }
  29. #include <linux/interrupt.h>7 Y/ g/ x- ^0 f1 N4 E
  30. #include <asm/io.h>
    * [8 y. I( f/ T" D# q, `# _" Z
  31. #include <linux/moduleparam.h>
    ! Y6 |, q7 k& u- O, L$ [
  32. #include <linux/sysctl.h>% q9 j; Y/ y6 L! y, D
  33. #include <linux/mm.h>
    6 ~( {6 j2 S- S+ u0 Q/ d- [( x- @
  34. #include <linux/dma-mapping.h>
    / i1 d. `" B: P; ?- W- m) c

  35. 4 K/ I5 m# S, O& G$ ~( ]
  36. #include <mach/memory.h>
    + {& R$ q  y6 q$ Y; G9 f
  37. #include <mach/hardware.h>) W; i  I0 U  P$ u5 o- @9 }
  38. #include <mach/irqs.h>
    ; m; Z0 C' x( O
  39. #include <asm/hardware/edma.h>
    3 J6 `5 K# t6 @) w! a- l# L7 {

  40. 3 L! ^2 I& v0 r. n! c
  41. #undef EDMA3_DEBUG
    & n+ \* i  G' k
  42. /*#define EDMA3_DEBUG*/
    0 E8 R) v5 V0 }% D( G5 n( m' F, J+ i
  43. 2 f& e4 S% N8 n# L1 m  o, J+ }2 X
  44. #ifdef EDMA3_DEBUG8 ?" b8 t+ O0 \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) X; q4 B, y% O! r; w! G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 Z& L. N: Q0 C3 i) H& o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) k, z5 q) |$ Z
  48. #else" r1 @, M' ]+ ], q! R1 U7 S3 x- q) y
  49. #define DMA_PRINTK( x... )& r- ]: n4 p# q: f( D+ Z
  50. #define DMA_FN_IN5 [3 ^1 H% L, }) Q- L
  51. #define DMA_FN_OUT0 V  z1 s: H6 A/ |3 c% c
  52. #endif
    3 c$ Z7 ~9 v+ V" }5 G$ I: N/ p3 W) \0 u

  53. 7 X9 a) `( X& t3 P" k8 {: @  P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - [& V7 Y, c7 |# p; e
  55. #define STATIC_SHIFT                32 U. Y7 F, G5 P& ~, p: k
  56. #define TCINTEN_SHIFT               203 p! C( ?9 R3 j7 U
  57. #define ITCINTEN_SHIFT              21" W4 C! A0 p3 Y+ n& m2 k
  58. #define TCCHEN_SHIFT                22
    2 i9 e8 A, w% K3 A7 k+ Y
  59. #define ITCCHEN_SHIFT               23
    2 g/ w3 n0 n1 t2 Q3 u* M% n. r* U7 h
  60. 4 p5 ~$ M( A0 M2 U7 B, m) Z$ S) T9 W
  61. static volatile int irqraised1 = 0;) i# Q9 H% V" b3 B  I, h
  62. static volatile int irqraised2 = 0;6 A5 R, X  F/ [; I4 g

  63. . C) F) u  G" N( j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) p5 V0 e2 x  K; r, R5 Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + }2 f9 ?/ [4 V+ o0 l5 C5 T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- Z) I0 g, K( x
  67. ) g) o! X5 D" S- c& J/ y$ P* P) ]
  68. dma_addr_t dmaphyssrc1 = 0;
    7 b- g" S4 i) g
  69. dma_addr_t dmaphyssrc2 = 0;
    9 P4 o, S" Q& ~
  70. dma_addr_t dmaphysdest1 = 0;" ]9 g8 }* G- {8 R6 _4 L& c
  71. dma_addr_t dmaphysdest2 = 0;, y8 ^& B; J+ n

  72. ) i/ _2 F0 F0 c" j
  73. char *dmabufsrc1 = NULL;7 z/ m" X2 l3 k: S4 E
  74. char *dmabufsrc2 = NULL;# Y" ~6 E5 Y: ^5 z
  75. char *dmabufdest1 = NULL;
    8 n. T3 f9 v2 F9 |
  76. char *dmabufdest2 = NULL;- L, F/ x) K) H/ k# Y

  77. 0 v* }9 B' X, E' w  p, e& C
  78. static int acnt = 512;
    * l" g4 p: y- f, @7 ~  u# B
  79. static int bcnt = 8;
    4 d3 I) \4 H: c9 `
  80. static int ccnt = 8;& a# x1 i; G: y: e
  81. ) ?# B$ ^) f( U; z! Z; b! g
  82. module_param(acnt, int, S_IRUGO);; K8 a" l8 |" e% h) T
  83. module_param(bcnt, int, S_IRUGO);
    ( `2 |) l! ~; R- \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 I) {, r( U; r' z: X% q, H" b5 @+ s: E0 d& f( ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 h6 Y: _* l* q! ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: Y* ~, _' C2 X  T* v
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ b1 w7 v0 {2 b9 D
% N8 c! |) s- N- k5 r
- q; `, i7 ?) T+ \% k- c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-12 11:19 , Processed in 0.038336 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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