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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 H/ ]. N1 t( `4 w: D7 ^4 h/ {
  1. [code]EDMA sample test application
    8 u! X& D. t' z/ }- m. d; e
  2. /*- ?/ W% C1 ^, \- K7 t2 v9 F+ a
  3. * edma_test.c
    2 i5 {2 E2 Q+ U2 j3 V- `9 j
  4. *
    0 ~" K' q2 E  x' K' [
  5. * brief  EDMA3 Test Application
    : f* J  w! L- z4 T4 T( W- Q
  6. *! K" b4 d* W: M4 v5 [, \1 t( b: W
  7. *   This file contains EDMA3 Test code.% w7 M- a! Z: _7 w. e# G
  8. *; @5 R. @5 D2 F4 u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 q$ T6 H% [) ]+ x6 i" _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' `  C2 v% S/ U1 U% ]3 g! s
  11. *         TO CHANGE.; C; G$ o: ?5 K. _# u, `! H8 X
  12. *
    . D/ u: p/ A+ a' M: e  B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # `- ]% O' u$ N% B) w
  14. *
    4 s5 C+ [/ n, J! {+ z1 i
  15. * This program is free software; you can redistribute it and/or% H, o* f: g9 }' t4 b0 z6 P$ V
  16. * modify it under the terms of the GNU General Public License as
    * L# X3 R6 J/ J
  17. * published by the Free Software Foundation version 2.
    ! b$ `* c5 }$ C: L. a
  18. *' t$ w$ L0 w* r5 L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 {3 N6 e: h/ n3 `9 f; w4 m: U# S
  20. * kind, whether express or implied; without even the implied warranty! s! K" K( n3 y) ]% E3 C0 e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 K* V# ~; Y8 ~; d' p
  22. * GNU General Public License for more details.7 `! H/ V/ A: g! \7 {. ]# i% ~
  23. *// r4 E& Z5 Y+ f

  24. ; C! v; e( ]5 G9 L
  25. #include <linux/module.h>
    , Z) M# \3 U1 {
  26. #include <linux/init.h>8 I5 M  \3 G$ M- h! ~6 H7 ~2 z
  27. #include <linux/errno.h>- X7 ?0 h; Q0 d7 n& a; w
  28. #include <linux/types.h>1 I6 b4 R; C6 u* O; H: y# ~: _
  29. #include <linux/interrupt.h>+ M7 p0 [; x2 h9 |
  30. #include <asm/io.h>
      |0 _& {& w# r  M5 e
  31. #include <linux/moduleparam.h>- v1 t3 x. f$ {! K
  32. #include <linux/sysctl.h>
    . c- S3 Y, ]0 R4 x
  33. #include <linux/mm.h>
    ; z/ U8 u' ~! ^
  34. #include <linux/dma-mapping.h>
    3 C  }; _! b/ X5 y

  35. # y$ N" p  r" J& q
  36. #include <mach/memory.h>
    / b0 N: M3 x2 I: H
  37. #include <mach/hardware.h>" W8 N5 y, V+ ~
  38. #include <mach/irqs.h>
    % x$ }& G+ Y5 F8 K9 G7 W
  39. #include <asm/hardware/edma.h>
    6 K% E2 Y/ D: E# I8 B0 L& z  |

  40. ) t5 D$ ~+ _1 k, W+ s: R/ u  K
  41. #undef EDMA3_DEBUG
    4 `3 u: D+ A- S7 M3 l# M2 S
  42. /*#define EDMA3_DEBUG*/0 u0 p8 y8 r( `5 t8 Z  Y
  43. % R( F% ~1 {9 ^) t8 A* w- l
  44. #ifdef EDMA3_DEBUG& M) d. |/ }  [8 O5 R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): I; b3 v6 E$ Z: |+ i" M. B9 v. X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & m- R' |) s0 a5 I. Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! G6 S+ z7 N" z! U. E0 F7 M( k
  48. #else( X% O5 Z3 e4 _( }
  49. #define DMA_PRINTK( x... )
    ; s$ Q3 i9 ?$ m5 P6 H
  50. #define DMA_FN_IN6 R/ f, a9 ^  p3 r7 ]  a
  51. #define DMA_FN_OUT
    5 b# s! O# H% u2 w8 G
  52. #endif
    ' i  E  I2 K8 l9 |+ j4 C' ^
  53. 9 h) {2 G& z$ i* ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( I6 s# J; V# W/ f0 C
  55. #define STATIC_SHIFT                38 `+ o" R3 W& {, V& _* D$ _  e
  56. #define TCINTEN_SHIFT               206 I  D. p- T1 y5 ~# p
  57. #define ITCINTEN_SHIFT              21
    , H  ~* S5 F% `% `& R, R
  58. #define TCCHEN_SHIFT                22: n4 C' b( H; g1 |$ G3 m
  59. #define ITCCHEN_SHIFT               23% C& u* H5 n8 O- ^: N) ]; y
  60. 6 q1 ~. ?9 n, E3 J1 u. ~- {: O  z: H
  61. static volatile int irqraised1 = 0;
    : w6 _" i- ?) c. S+ O( R) `# B6 ~
  62. static volatile int irqraised2 = 0;
    1 f7 X& o* y4 A0 l* _

  63. - z- w& r# I! }9 n* j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " U( V5 M& r3 x$ Z7 J0 I) N7 d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # A6 N6 y. U& N8 u" y* f6 y0 b: Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' U6 Q: V7 `, i, u3 _: H5 M

  67. ; L' }$ O) K$ u. ^
  68. dma_addr_t dmaphyssrc1 = 0;0 h0 D2 N2 i% h: w& |
  69. dma_addr_t dmaphyssrc2 = 0;
    1 L# C& G& N! I: k( ]7 i0 {
  70. dma_addr_t dmaphysdest1 = 0;  L4 b% v) y4 M% L$ x4 X1 n  V4 p
  71. dma_addr_t dmaphysdest2 = 0;
    9 k* {& W& r2 w8 }+ P

  72. 9 v+ M0 J3 h; w" i- i4 V
  73. char *dmabufsrc1 = NULL;0 K- q4 U$ o2 D! ]  l% C
  74. char *dmabufsrc2 = NULL;4 D6 c7 Q( ~8 u, z  {
  75. char *dmabufdest1 = NULL;
    # K3 C2 a8 I) S
  76. char *dmabufdest2 = NULL;
    / L: E3 W* i6 }2 u) e3 `
  77. & d: _1 O4 t& a
  78. static int acnt = 512;/ C; O1 L" G9 [/ c! m" U# P- Y  a" P
  79. static int bcnt = 8;
    8 g1 Q9 `. D) h8 d/ h
  80. static int ccnt = 8;+ g$ N( r. g, k
  81. $ i# \! U, Y5 B  M7 n
  82. module_param(acnt, int, S_IRUGO);% A$ w( u8 ~) ^
  83. module_param(bcnt, int, S_IRUGO);
    5 z7 B3 j, v, n# C: ^+ g3 W" i; V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" C! }+ j% }5 \/ y5 A* R  C$ Z- s' C* R
4 U  n4 U1 `3 `- v9 L      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 d, W) K- q- H7 b# x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* P' U1 }1 o6 n6 T
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; H2 e9 x" d% I) d: F! X+ b1 X
+ I3 g8 j3 {, r

. `; n+ G6 ]: C1 G& a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-20 12:21 , Processed in 0.041357 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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