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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* Q6 ]4 w1 h  Z( V9 C( o$ e3 Z  Y' r
  1. [code]EDMA sample test application& g* L0 t* T" C& P. n& D% ?, j
  2. /*9 V8 B. ~7 p& X- y7 C6 J5 y1 }
  3. * edma_test.c* b; @, Z: Q. T- U4 e# ]! M
  4. *
    7 w+ V* W1 F, Z  k5 k+ b9 Y
  5. * brief  EDMA3 Test Application  M. Y6 I( W' F, v4 F3 L
  6. *3 l+ v7 R9 W# c5 h# [" c( S
  7. *   This file contains EDMA3 Test code.
    3 ~0 P& n( N' z+ w- ]( C
  8. *
    ( {1 G# \% k- K8 J" k" |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# a; _1 C% W) V& ]! g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ K3 L6 x5 K. k& N, r( J- I
  11. *         TO CHANGE.
    + P( z  w  x$ J8 Z% t( X( q
  12. *1 o$ w* F3 v* P- V, K9 j( g5 T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! c# f& v, N1 v% y
  14. *5 [0 F6 `" g% B, ]
  15. * This program is free software; you can redistribute it and/or' u9 S, Y. G3 P
  16. * modify it under the terms of the GNU General Public License as
    * y6 W( q7 h8 ]6 O( q" q3 A
  17. * published by the Free Software Foundation version 2.
    0 v" {4 p' c+ A2 J7 w# V# N
  18. *; d6 N* c. P: f. s- M. P! b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - W0 f3 G$ c, K9 n' [, [. E& e. Q0 k
  20. * kind, whether express or implied; without even the implied warranty  b- L# v# R. Q( g  v# o  B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ w8 ~, k  N5 l: c4 i, ?
  22. * GNU General Public License for more details./ R' T* Q+ e! d  B
  23. */6 n7 K+ {/ G3 U' U/ E1 n( S
  24. 9 k, U1 q. r4 [% I1 [& u7 n
  25. #include <linux/module.h>* o8 @. j9 B3 v+ O$ T( T0 e& f- o
  26. #include <linux/init.h>& T+ Q/ H3 g# G6 t
  27. #include <linux/errno.h>, b; a. C0 ~( I! {( Z; d
  28. #include <linux/types.h>
    - l2 K+ ]4 Y9 P* H0 r
  29. #include <linux/interrupt.h>  `% l) }- R& |0 [* B
  30. #include <asm/io.h>6 k! K" j; B7 B. r% T7 X% j
  31. #include <linux/moduleparam.h>6 h1 G" x# W# n: v9 k
  32. #include <linux/sysctl.h># o$ P, f- _. x. M
  33. #include <linux/mm.h>7 |1 |4 i8 E% g
  34. #include <linux/dma-mapping.h>
    3 ^1 t! O, Z; H" k2 @8 o
  35. # }7 `  h# t% C' d! T- i
  36. #include <mach/memory.h>: A" f4 v2 M" T' c9 b
  37. #include <mach/hardware.h>
    + C7 M8 `0 \4 b1 r! [" T1 {
  38. #include <mach/irqs.h>" @  w0 R8 R7 R, _7 t
  39. #include <asm/hardware/edma.h>
    5 |& c" [* q6 {5 u/ U( H

  40. - i( z1 i5 l! C3 T3 P' b: x" j
  41. #undef EDMA3_DEBUG
    ( P7 W0 G6 \1 ^. B' d' B
  42. /*#define EDMA3_DEBUG*/
    + d8 t, |1 e3 @7 R/ N2 }

  43. 4 v& J# ?* \  |8 @1 N* y9 o
  44. #ifdef EDMA3_DEBUG2 J2 S$ g! i% }) w$ e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), D+ n4 Y, Q1 p; H3 s* P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" `9 C6 |$ f2 L6 C4 R1 `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- V/ Z* ~6 M% R
  48. #else/ ~( S" s0 l- S$ ^
  49. #define DMA_PRINTK( x... )
    5 O3 W5 {8 j+ |  P
  50. #define DMA_FN_IN
    7 }; ^, L( ~+ H% v" o
  51. #define DMA_FN_OUT
    ! H- R; `, o/ z3 [; L: n) e+ ^  l
  52. #endif, o! S1 k* Y3 t" @$ o5 D

  53. 5 \7 R" N5 J4 o- j& t5 Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ R+ Y0 r0 w+ h; u( `- N
  55. #define STATIC_SHIFT                3. \! d0 h; Z6 W( q+ v3 N! G7 _' a
  56. #define TCINTEN_SHIFT               20$ {2 D" F9 R6 f5 a9 L9 Y
  57. #define ITCINTEN_SHIFT              21& K# H4 M- |+ m2 h
  58. #define TCCHEN_SHIFT                22
    ) p0 z3 P3 ^6 s* J. O8 W! S! V
  59. #define ITCCHEN_SHIFT               23
    $ x% b+ P9 P4 T7 ?. A

  60. ( U# E, g$ i1 k$ b9 V  j( x5 N
  61. static volatile int irqraised1 = 0;1 @! A( [2 S8 C# o
  62. static volatile int irqraised2 = 0;
    ! D8 R2 b) U$ v; Z9 c! q, c

  63. 4 i7 }. H  z* z3 a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . O4 f9 e" B( I/ w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( y6 K5 |; Q+ A7 s5 ~; W, P* `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  W% X, _( ^6 w2 l9 P6 i

  67. / w* U8 `/ Z' b7 g0 q
  68. dma_addr_t dmaphyssrc1 = 0;
    4 n# D8 F2 I- J
  69. dma_addr_t dmaphyssrc2 = 0;
    8 d1 r/ C$ m3 M4 Q& Y
  70. dma_addr_t dmaphysdest1 = 0;
    2 Y. O7 ~( G$ T* O* o/ Z
  71. dma_addr_t dmaphysdest2 = 0;
    ' B# g2 B3 E9 _/ ]5 y

  72. " A. d8 _( C4 t- j
  73. char *dmabufsrc1 = NULL;2 O9 ?- F/ d$ f9 m' C
  74. char *dmabufsrc2 = NULL;2 a# f; M- ]- n( h9 k) l9 k
  75. char *dmabufdest1 = NULL;2 y9 s' q! [2 X" P
  76. char *dmabufdest2 = NULL;& X; W% ~) w8 y1 e" c) r
  77. ) q# p* ]3 g7 l' Q
  78. static int acnt = 512;
    # a$ W0 S' n( R2 k; B2 [& h4 r  x0 d" f
  79. static int bcnt = 8;
    2 d0 m* |3 B% Z: V+ Z! r3 M
  80. static int ccnt = 8;
    8 ]4 k5 w7 T4 W) q; X2 m
  81. ; p. k8 B  S. T% y2 }
  82. module_param(acnt, int, S_IRUGO);
    8 I! K' r# F1 G& B* `
  83. module_param(bcnt, int, S_IRUGO);
    ' m5 X  ~* a1 s- W# X. A: M
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 O' f" O6 q# ?9 |5 l' T

. q' I) f$ F# X- `. n      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  W% I7 e( P2 ]' f! w2 Q* h. yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: l  f8 w( Y) |, }( y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 M& j1 r7 d! t' H

( P9 M4 ]- c: V1 p" l( L) j- w2 `" n7 c7 `# c1 _5 b# m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 05:16 , Processed in 0.040527 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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