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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + Y4 T% s( P5 @6 O8 p
  1. [code]EDMA sample test application, ^5 m$ d% ?4 Z: h
  2. /*
    * Q& ^9 P1 M) r& w' J
  3. * edma_test.c
    - P2 I8 `0 ]' Z: b) ^. f7 M
  4. *
    6 G, K" {( S  j2 a) f+ J! Z) B0 q
  5. * brief  EDMA3 Test Application
    6 t# N1 `+ \0 _) y. b$ o
  6. *8 }2 `4 f# Q- }: q" N2 q6 a
  7. *   This file contains EDMA3 Test code./ k+ L; Q8 u! c# t& ^, ~- ]% k
  8. *
    . R2 R" z0 J2 Z$ S1 W" B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' X  z' G5 P: m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 K' A# n0 H3 e/ n! u$ H
  11. *         TO CHANGE.
    8 p5 f' K/ y3 h. z
  12. *
    ( ]+ n+ z7 L$ c* d( {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ }) p; S( \. ~$ s. [! i
  14. *
    ) O$ c4 s9 ~+ [- n
  15. * This program is free software; you can redistribute it and/or
    " g5 {9 n% Y9 K5 u
  16. * modify it under the terms of the GNU General Public License as# f& J9 c; B. H8 n
  17. * published by the Free Software Foundation version 2.
    4 {' B" u2 J* T2 h/ }+ Y& G' d9 [7 @0 A
  18. *
    1 X% _+ b- X5 |2 V. T. }0 Q  [- a" Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . o& m: g) ?% W# i5 |9 g
  20. * kind, whether express or implied; without even the implied warranty
    - C" e. I2 D) J6 c8 r; e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( F# `" x3 w1 f& A) }
  22. * GNU General Public License for more details.; b) d, Y' M+ k, f8 C2 G
  23. */
    " Y% U9 s. g9 [
  24. ) z) p* y, R; a( R4 p0 U1 U) {
  25. #include <linux/module.h>! l  @; f6 K9 E& ^: J+ V
  26. #include <linux/init.h>
    , R3 ^6 D% `9 W7 q  Z  i6 ]. u
  27. #include <linux/errno.h>
    0 c7 V; @2 F7 O) H6 E) Q6 T
  28. #include <linux/types.h>) e8 h6 j. ?' }( \( c& A
  29. #include <linux/interrupt.h>" R1 `1 y) |7 H$ D9 @
  30. #include <asm/io.h>
    $ M0 L% P- p4 I
  31. #include <linux/moduleparam.h>3 h- b% O& K( d7 ^6 [. }
  32. #include <linux/sysctl.h>% V9 ]# d4 a- O9 t( m
  33. #include <linux/mm.h>
    4 _7 P2 j' ]! H: }
  34. #include <linux/dma-mapping.h>
    - O; a5 D& D" |8 Y2 t* A( U( u
  35. ' H. Z* P. \/ c. j) q
  36. #include <mach/memory.h>4 u3 ~3 h% K5 W
  37. #include <mach/hardware.h>! ]1 y( i& D2 z& R3 D  G3 L0 P
  38. #include <mach/irqs.h>
    0 }/ N$ y0 x4 ^0 Y; F! `
  39. #include <asm/hardware/edma.h>  i$ f+ g) V6 B& z, E: e
  40. 0 {2 t8 ^/ L* b" j
  41. #undef EDMA3_DEBUG
    ' R" p) l, o! Y+ g) o1 p
  42. /*#define EDMA3_DEBUG*/. p7 ~) m( G  v7 W; i
  43. - Z# P* Z+ l. j
  44. #ifdef EDMA3_DEBUG
    6 Q9 e& T7 C& L* M5 Q7 A9 _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ z7 c* H& |. U5 S$ o$ t" X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 ~, g0 J0 T6 h( a, E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 d3 N: E2 ~3 W( e+ s- j5 G- `+ h
  48. #else: X( Z3 ~+ }. C$ X
  49. #define DMA_PRINTK( x... )
    9 [; G( D" e/ S* [/ h; a
  50. #define DMA_FN_IN/ S" H- n0 u8 _- S) \+ A1 [
  51. #define DMA_FN_OUT: ]. u" }2 }0 n: f/ O8 |9 ?
  52. #endif+ J% k- Q& L+ ~- h8 y% G/ f
  53. % o* o$ A( p6 i7 b# Y3 R$ N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 ~8 ~& E' q1 L' ?" _. G; {* Q
  55. #define STATIC_SHIFT                3  c% ^/ B; {* C
  56. #define TCINTEN_SHIFT               209 C/ X1 e4 Z( u' l- y0 E  z' x
  57. #define ITCINTEN_SHIFT              21
      F2 A5 ?. D" ?; L6 `# a
  58. #define TCCHEN_SHIFT                22
    5 s0 m) V* v7 ]
  59. #define ITCCHEN_SHIFT               23
    9 M+ `; I( P1 }+ a4 k0 R8 s
  60. , I. q% F5 r/ R' K$ t* P
  61. static volatile int irqraised1 = 0;' n5 V: `& s9 {4 p9 _6 }, H
  62. static volatile int irqraised2 = 0;
    6 I8 p( J/ v, g. K4 U
  63. % N/ O+ P* v! y  t( V% A) T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  O4 q$ Y* Y, P8 L9 ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; l* A; T' w7 l) e+ `4 \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 Y6 j* L# P' m( r; B  T2 `

  67. 3 _  H4 p' Y: G, S' W$ C" e- P7 Q
  68. dma_addr_t dmaphyssrc1 = 0;
    6 j& }3 e, Y, P
  69. dma_addr_t dmaphyssrc2 = 0;, C# K# j" G9 {  {2 v
  70. dma_addr_t dmaphysdest1 = 0;' u0 R/ W- U. f) o8 g8 H+ @
  71. dma_addr_t dmaphysdest2 = 0;. _/ K: L* p8 ?% V# j% h
  72. 4 v( I7 [: }: U7 ?0 G' L
  73. char *dmabufsrc1 = NULL;0 Y/ E2 F0 s  e8 B# `3 ]
  74. char *dmabufsrc2 = NULL;5 U, I3 l! s6 Y) C) g. \+ X
  75. char *dmabufdest1 = NULL;; s/ @8 o, q2 m5 s1 M6 k) V' D/ e! y
  76. char *dmabufdest2 = NULL;' i* S+ N4 S, y# j, d" p0 t) u

  77. : o- z4 c9 A1 I# g% I
  78. static int acnt = 512;
    # o. p. X9 e3 l
  79. static int bcnt = 8;; P# U, u+ ?+ \1 t6 w1 E" K7 h
  80. static int ccnt = 8;* l5 g6 [* Y5 x" N1 I

  81. 0 r0 p  r; Q5 \5 w1 [
  82. module_param(acnt, int, S_IRUGO);  a& w2 }1 i9 Q, l6 b
  83. module_param(bcnt, int, S_IRUGO);
    ( e  s8 ?  ?) b; E( k/ b' e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( i1 \6 ^; ^  p, Z1 j0 u. x; d5 \
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 n1 c6 D( {( T2 k. M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 b& d1 Z5 L' ?8 n     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 P0 U5 b7 M( m

4 S* h! k2 |" t2 P% q# h' m
( u! S  K: D* ?7 F, B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 09:25 , Processed in 0.040747 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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