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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 b- ~; H# G3 l8 ^& l- r
  1. [code]EDMA sample test application% a  ?3 p: t  u- J3 {
  2. /*
    8 S3 n6 e- Z2 q, d
  3. * edma_test.c
    ; ^& _/ K' g' Z, A" T
  4. *% W, |) [: c' }' Q- ^0 E/ g
  5. * brief  EDMA3 Test Application
    " B! z' v- _' K) h
  6. *9 w2 k( i) \9 V+ J4 X5 X# s9 f
  7. *   This file contains EDMA3 Test code.' ]9 F# b/ n2 \( j- w
  8. *% Y/ h  J0 p2 S; D  ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / m: s1 F" x7 n8 w' c" t, s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 B1 z2 p/ L8 r
  11. *         TO CHANGE.& a: Y2 Y* }6 @* g  T6 Q' Y: O
  12. *
    , T  D* d. k1 f) Z0 W( a! j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  P& u1 c2 W" I( f4 `
  14. *
    / G& H3 y8 S8 Z% m  g6 z! O
  15. * This program is free software; you can redistribute it and/or* G. w( ]8 z% C) K+ u
  16. * modify it under the terms of the GNU General Public License as! N( X# e! u, n
  17. * published by the Free Software Foundation version 2.
    $ h6 Y3 ]/ `0 h% P! w( u3 L) [# S8 u. u
  18. *! B  ~& P2 b: H; w4 S& D& c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# q, P0 [- N9 I! k) d
  20. * kind, whether express or implied; without even the implied warranty7 m( r) {8 R7 q0 J6 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 Z6 q6 }6 a% j3 x. h  X$ W
  22. * GNU General Public License for more details.
    ' v" O% x) K' F0 W. u8 T# I
  23. */
    ! \1 l8 k# E8 Y8 O. b) R& N
  24. " L6 h( f% _2 B
  25. #include <linux/module.h>
    6 n- {5 w# z7 a" ^$ v: N' y7 I
  26. #include <linux/init.h>: E0 p  j- B6 v: p
  27. #include <linux/errno.h>
    4 L7 p& A4 @/ o/ K9 B1 N1 W
  28. #include <linux/types.h>
    7 C. O5 v0 e5 {- [
  29. #include <linux/interrupt.h>
    ) }4 Y2 X+ h) e0 W( B! H8 b0 N  `7 m
  30. #include <asm/io.h>6 X: K, x) e) H1 m+ K
  31. #include <linux/moduleparam.h>
    2 A7 N2 p8 i$ ^/ u
  32. #include <linux/sysctl.h>* l3 z! M% b- X" c$ z( [  m
  33. #include <linux/mm.h>
    " N4 `# b4 U9 u2 ~8 p8 s
  34. #include <linux/dma-mapping.h>& a/ m1 o- M) {' p7 R# N
  35. 1 l. \9 v6 \" u
  36. #include <mach/memory.h>. ]) M, H( n% h/ [+ y; P2 S3 o
  37. #include <mach/hardware.h>* A, t9 Y; q) y9 r: R8 K* S- T
  38. #include <mach/irqs.h>% B% L( L' j& X9 I3 W0 q) |
  39. #include <asm/hardware/edma.h>. S1 \' J. b  K8 W0 X/ |' B
  40. , M5 K+ J: p7 t6 S1 t0 y
  41. #undef EDMA3_DEBUG) H% ?8 w: D" |
  42. /*#define EDMA3_DEBUG*/
    + U9 B2 `* [5 l" c' E* V; n: o
  43. 1 w  r  b6 ]0 r8 s0 `8 u, {  b
  44. #ifdef EDMA3_DEBUG
    8 E/ [6 q- z7 Y9 A$ |/ t2 n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 Y5 W9 {, L+ [3 T+ w0 P$ s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 x+ v0 K  e" I9 G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ f! |$ S5 x, i5 p% {
  48. #else
    " ^* B) J' L; X) R% Y
  49. #define DMA_PRINTK( x... ), H' L$ b, ~0 X, J6 Y8 Y
  50. #define DMA_FN_IN. i" I' E; j. e4 x
  51. #define DMA_FN_OUT$ s. @  S2 a2 {5 Z
  52. #endif
    9 L; o2 k3 I( r

  53. 8 w$ A( I; Y: l3 |% K7 m5 L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 @$ j( v: S2 @1 B; }" m# w# _
  55. #define STATIC_SHIFT                38 N5 l9 a9 L  x4 w
  56. #define TCINTEN_SHIFT               20
    9 m5 u2 }$ g" {+ `) q6 K
  57. #define ITCINTEN_SHIFT              21  z8 L, J2 ~5 Q$ V$ ?
  58. #define TCCHEN_SHIFT                22
    3 a5 G8 E4 d: n' c8 N  N9 ]
  59. #define ITCCHEN_SHIFT               23
    - v" b& T9 T+ h1 O* z
  60. ( q+ R! e# U* D( M$ F* u
  61. static volatile int irqraised1 = 0;
    : b3 m1 ^; p* Z' {* [
  62. static volatile int irqraised2 = 0;
    8 P+ f( i9 y! w- D
  63. " j, S9 d8 h! S0 }8 w, ?# o0 H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! G, w- {! h; B2 ~4 u2 K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' |2 q  a# t# F* w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; ^$ v0 l, ]; R, t7 X
  67. 4 m2 j6 ]' I* ^8 p1 `! s. h" H, G. Q
  68. dma_addr_t dmaphyssrc1 = 0;9 z) R# D2 ~, z( y
  69. dma_addr_t dmaphyssrc2 = 0;0 v+ }2 x: b2 w0 ]/ ]. I
  70. dma_addr_t dmaphysdest1 = 0;+ B+ v1 {+ t7 l) j' n" s
  71. dma_addr_t dmaphysdest2 = 0;* F0 k  ]) }1 F

  72. . b; v5 H6 h2 i
  73. char *dmabufsrc1 = NULL;
    6 V; b% I8 X# B* s6 x' E6 L8 g
  74. char *dmabufsrc2 = NULL;0 j6 Z  f3 [+ y
  75. char *dmabufdest1 = NULL;
    6 e+ I9 i9 o$ b5 p0 u! P
  76. char *dmabufdest2 = NULL;
    ; i6 d' [: f" z1 [

  77. + n4 o2 \! p+ }, `' T7 R( i5 B; T& L
  78. static int acnt = 512;
    ; W- b+ l+ R9 L3 T( |. I
  79. static int bcnt = 8;7 g1 U4 Z. [% t4 c! D" }) C
  80. static int ccnt = 8;4 t) G6 M& P. W1 D! I
  81. 6 X/ s) d7 p7 t1 J( w2 Y0 q
  82. module_param(acnt, int, S_IRUGO);. y) a8 ]( X! ~* z: h8 }
  83. module_param(bcnt, int, S_IRUGO);" B2 _; N$ U% @8 b+ W$ ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# B) Q9 R- n1 X; }, H/ u& k, M
& J( l( T: L/ [      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 }$ x" m/ n5 L* u5 D) M; jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% T% e9 ^8 K! m# k0 ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 l2 w0 |! r: J( f' t# d9 O7 L  n0 W9 \: p2 b
5 r. l- p. }: A& b# y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-21 23:26 , Processed in 0.038206 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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