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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . j8 _8 o+ X0 o+ J- E  x* j
  1. [code]EDMA sample test application! B  {; \: {, l5 E& X' u& X7 Q
  2. /*+ f2 K# F& }6 c  A8 M/ V
  3. * edma_test.c
    + q7 C6 P; O1 b" U+ ]6 j
  4. *% W, [' g2 c3 [4 C& Y
  5. * brief  EDMA3 Test Application
    3 v* T7 @. T) F. R! ^; E8 w9 _
  6. */ g0 }" q5 i1 I, e* Y4 D: v" u  x
  7. *   This file contains EDMA3 Test code.* `7 x  \: d( P
  8. *& t  l# m, Q! y" y$ j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! g9 z+ [  _& ~; g0 p; B9 i8 q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # S2 [% k- o, g4 C8 I/ J  v
  11. *         TO CHANGE.
    5 _/ @7 e2 ?) r' M: R9 F( H  H
  12. *
    * Y" |$ h1 w3 b7 B$ b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, ]4 H& `* F- t* `. A) b
  14. *$ F; `) U) i. k& o  _; T
  15. * This program is free software; you can redistribute it and/or" X3 ~0 d, @9 m, z% H: b1 C
  16. * modify it under the terms of the GNU General Public License as
    2 e/ t6 c' H9 O8 ?2 v1 j" }
  17. * published by the Free Software Foundation version 2.4 |; _6 }) V: @
  18. *( L4 j3 V* q* _; m! V1 y+ N8 U' q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 H; s, a/ K4 O
  20. * kind, whether express or implied; without even the implied warranty. L9 v( b2 p  J+ E! \; |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 _6 \( |3 q- n, l7 ~
  22. * GNU General Public License for more details.6 s/ _( N+ s: g9 e& J$ {
  23. */
    " M( p0 T" B- i* m! G. T8 O
  24. # T  T: C* Q: h4 m" h- Z
  25. #include <linux/module.h>( u* K& B" ]) Q2 j7 |) N
  26. #include <linux/init.h>! b' n7 q( f4 s( v# X1 ?' F/ i
  27. #include <linux/errno.h>& y1 H2 F3 Y% p' G5 F
  28. #include <linux/types.h>  n. V3 j* h; m, u" V' E6 j
  29. #include <linux/interrupt.h>( A. c  n: i! t, w  |7 U
  30. #include <asm/io.h>% b. \" ]6 P' P' O; ?
  31. #include <linux/moduleparam.h>* A* w; I" }" s/ q
  32. #include <linux/sysctl.h>( L/ o  i' h/ {: G
  33. #include <linux/mm.h>
    9 |% q* S: g4 \1 b
  34. #include <linux/dma-mapping.h>
    5 D1 |0 f0 S& h3 n( E5 e# D
  35. - a; K# n8 z# ?! E" i! B2 s
  36. #include <mach/memory.h>% x, R5 [. f. b, p" Z0 P! N, o, ~- `* c
  37. #include <mach/hardware.h>
    , k$ Z5 m7 p. b$ g
  38. #include <mach/irqs.h>* m  L+ {7 z: x9 P. s$ X) i
  39. #include <asm/hardware/edma.h>
    6 M  ?( f# M! s

  40. 9 O2 E# A5 O, b2 T
  41. #undef EDMA3_DEBUG# R! r: a7 V6 g6 x2 z3 Q" u4 X
  42. /*#define EDMA3_DEBUG*/
    3 l/ u+ `6 a$ }: _% @0 k
  43. . S! Q, U5 P& t# I
  44. #ifdef EDMA3_DEBUG
    5 b' O* c& Y! g1 X) y/ z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . G" W4 U7 {5 i9 c' v4 t$ y' f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ v" }3 x( s( U( G/ ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* V6 a' d8 h- f* @, L
  48. #else
    9 I# ]& P, F2 d& q
  49. #define DMA_PRINTK( x... ), ]! [. {1 W, C9 L! b' z! D
  50. #define DMA_FN_IN! x* P+ Z3 q1 V4 J3 z
  51. #define DMA_FN_OUT6 n6 M( N' p. c: ~
  52. #endif
    # n$ w" t5 Y4 z
  53. # ?8 B: H9 N# Q* l, i4 Q; `# z7 V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% g% [0 z$ k) ]1 S: `
  55. #define STATIC_SHIFT                3( P5 p! g) y5 `: i$ R# w& U
  56. #define TCINTEN_SHIFT               20
    ' A7 m# i1 L* _  ]
  57. #define ITCINTEN_SHIFT              215 K5 C' }7 f' V) _! v+ ?
  58. #define TCCHEN_SHIFT                22
    - }6 T( C; J2 t3 O4 b& z0 G
  59. #define ITCCHEN_SHIFT               23; Q  H4 @3 T* e/ t
  60. - u# L6 V$ M/ r, e! p9 w- \
  61. static volatile int irqraised1 = 0;" e! |0 H* q; M/ L4 [8 K
  62. static volatile int irqraised2 = 0;8 B9 z$ A1 A0 D3 N& Y0 c, W: a

  63. ) d. b* Z6 i; t* t2 b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% a# A9 O6 V( \3 T+ n; m+ j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" @) f. F. B. X" B/ _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: G) [4 Q$ U" a! |# M# h5 [
  67. : m  [& k3 q$ u8 |. }$ }+ }
  68. dma_addr_t dmaphyssrc1 = 0;- Z  v* @7 j  `$ j
  69. dma_addr_t dmaphyssrc2 = 0;; w) d$ q7 x& G
  70. dma_addr_t dmaphysdest1 = 0;7 A7 O0 `4 A. w& S' c/ t
  71. dma_addr_t dmaphysdest2 = 0;' ^6 B/ w! I7 n+ C6 d1 j, w8 [! I

  72. 5 m3 k8 M2 p- G) Y: {
  73. char *dmabufsrc1 = NULL;
    4 N* E) ]' @+ H, n. M; v5 d
  74. char *dmabufsrc2 = NULL;1 C& m  p  Y. a3 I. w5 @, a
  75. char *dmabufdest1 = NULL;+ C( y: i' B  S3 ^& g- x/ ^: h
  76. char *dmabufdest2 = NULL;9 w5 R+ r0 E+ K; r

  77. % o" P* A. Y$ [; q$ O' Z
  78. static int acnt = 512;' R2 C0 Q- V% ~2 }2 ]6 h. u
  79. static int bcnt = 8;
    1 o. I1 U  m- n  W4 p
  80. static int ccnt = 8;6 _. r/ c* C" w9 G( t4 t
  81. ! J/ M; L+ }6 V5 p/ G" ?
  82. module_param(acnt, int, S_IRUGO);7 Y- I# U8 s- |. I
  83. module_param(bcnt, int, S_IRUGO);
    : i0 y4 a, x5 e- a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, i8 c' y& i$ `5 w) r
; U  c, R+ W- H# J0 b+ Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 P9 M  p( t" d: \3 s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  k( `0 `, _# B# ~0 m
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* C9 S& k4 O) q. K1 }. u$ o1 i1 Q. ^% Y  J$ m9 w
$ y2 q9 A& q# A* Z/ V0 d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-6 14:46 , Processed in 0.042831 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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