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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 \, i6 e5 f# _3 k7 w' k
  1. [code]EDMA sample test application
    5 Z" f, R; w: [0 g  M  u$ c( B& }
  2. /*
    4 v. [+ F2 W1 [' e! B
  3. * edma_test.c
    . _4 v) L3 N7 A5 S+ r
  4. *. a! O2 d: Z8 Y) R
  5. * brief  EDMA3 Test Application
    5 A8 ^( t- y3 C- l5 t
  6. *# T, W0 U6 g: ]; P/ b& M! W, L
  7. *   This file contains EDMA3 Test code.
    3 C, Y0 m/ O' p, i, h8 G
  8. *9 f! n7 A6 X; R) b0 r: c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . Y1 L: e% d8 C% }1 F4 f1 T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " V5 R+ ~& {: M3 P1 G; `- q
  11. *         TO CHANGE.
    0 q( h9 q  L" t5 b
  12. *
    % T7 ?+ E4 q, `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) p/ v* ]+ x  d2 }* b( ^0 u0 b
  14. *
    + R* f) s5 q0 o- D# s5 j
  15. * This program is free software; you can redistribute it and/or5 }3 X: Z9 v* I$ U9 N
  16. * modify it under the terms of the GNU General Public License as4 q) {% X& G+ f) I( {
  17. * published by the Free Software Foundation version 2./ @" R2 g: n& a5 n2 [6 C
  18. *9 R* z+ o6 M. n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 d7 O4 p+ d( B/ p* E
  20. * kind, whether express or implied; without even the implied warranty
    9 A6 m: J/ m  d0 `! T/ v0 A7 B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% i3 T6 U5 b6 u" ]( L
  22. * GNU General Public License for more details.1 K1 o3 t; y" A
  23. */
    8 m$ ]8 H4 B1 ?- g: s6 Y
  24. 0 t* K3 T3 [! \! s9 {7 c* a4 N
  25. #include <linux/module.h>
    + M3 {  L5 s( [! y2 \5 z
  26. #include <linux/init.h>2 r' g1 U% m4 d9 v! k; @! N1 j* [
  27. #include <linux/errno.h>1 ^0 ^3 H- [; \# D" i
  28. #include <linux/types.h>
    # t1 U5 U( K) p8 |% A
  29. #include <linux/interrupt.h>- _) }; z, |+ e4 R3 B, M- r, b# W4 H. i' b
  30. #include <asm/io.h>
    + Z) o6 ~# R9 ]1 p" R9 S& O
  31. #include <linux/moduleparam.h>* y) D6 S# J7 Q. b
  32. #include <linux/sysctl.h>
    $ I8 [; v* f* l% ^
  33. #include <linux/mm.h>
    8 q" U( N9 k- c# ]* a# _
  34. #include <linux/dma-mapping.h>+ E: h' Z% ]! Y3 C
  35. " Z9 y, `( y+ J  n" B: i8 [
  36. #include <mach/memory.h>
    . P$ K8 T( H3 ^
  37. #include <mach/hardware.h>
    - u) C( P  L( _. `8 c7 b
  38. #include <mach/irqs.h>; {5 A& g* t0 {5 p6 M
  39. #include <asm/hardware/edma.h>! u$ s) O$ a* S3 s" Y0 j
  40. . G! ~2 V4 y6 R) f: o
  41. #undef EDMA3_DEBUG% ~. k; K5 q. q, b2 N9 }! K4 U; w! V
  42. /*#define EDMA3_DEBUG*/. p7 F2 m$ j( S' a: Y; q
  43.   Q% Z4 r1 @7 L0 \% m! ~
  44. #ifdef EDMA3_DEBUG
    . A! T& X5 x& [+ G1 H, Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 X2 Y& m1 g. y( O: ?+ M$ r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), C4 x4 ?5 a7 K: |/ V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 E1 E$ Q9 x% @+ \( C8 P3 ~
  48. #else9 }( F- o9 x" K- ^# T
  49. #define DMA_PRINTK( x... )
    ) [3 t: w4 v5 n8 G9 M3 Z5 K
  50. #define DMA_FN_IN. u* K9 n5 j: M
  51. #define DMA_FN_OUT* ~* n# s" ]7 t; W" g
  52. #endif+ D# t; M6 x/ s* |+ P

  53. ) ]0 D8 f5 r! ^0 I; `" B3 Z4 {* k0 _/ S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 h# K, a$ @" t1 t- \5 |2 n
  55. #define STATIC_SHIFT                3
    : v6 S2 H- K2 z! d$ c
  56. #define TCINTEN_SHIFT               20
    / v" A. ?) R  a8 N5 C( s
  57. #define ITCINTEN_SHIFT              21
    ! q/ ?4 G! Y" C- F) g
  58. #define TCCHEN_SHIFT                22
    , D9 k' s# Q9 F! ]6 J
  59. #define ITCCHEN_SHIFT               23
    ( a5 m  s% F8 `% d8 W

  60. 2 I9 p- K6 L" i1 Q5 @# u+ l
  61. static volatile int irqraised1 = 0;( `! c6 e% y" S
  62. static volatile int irqraised2 = 0;+ Z& l  B: h+ [

  63. % \) u7 q7 K5 v: \5 ]! S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- ]. x3 i) \0 V7 Y2 N( I' F# A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 D/ X8 V/ L- r6 O/ k2 D# w6 M* P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / p3 ?, |6 X- |) {' M0 U, m- K, |
  67. 9 o, `" Y- I; v2 Q
  68. dma_addr_t dmaphyssrc1 = 0;
    - Q" B. e# a: u6 m% K: |, ]
  69. dma_addr_t dmaphyssrc2 = 0;# Q3 d0 X9 ^- [& J& x# p
  70. dma_addr_t dmaphysdest1 = 0;
    / Y, H4 o( P4 I
  71. dma_addr_t dmaphysdest2 = 0;
    7 |* S7 p1 d! A( g8 P
  72. 1 Z$ L5 G7 r$ g1 |  C  J
  73. char *dmabufsrc1 = NULL;
    , q+ H; `1 B; T/ u
  74. char *dmabufsrc2 = NULL;. R2 `9 @5 j' ~! K* u7 y
  75. char *dmabufdest1 = NULL;
    0 E4 D: j& _7 l4 @1 y7 p+ `$ T, U  M
  76. char *dmabufdest2 = NULL;1 g' W3 _5 }( o) G* y1 z6 o
  77. * V4 h5 }, D) ]( h6 Y% d
  78. static int acnt = 512;
    2 g$ Q% ]+ f# S+ D. f' P
  79. static int bcnt = 8;% z6 Z  M( M* W/ ~/ {7 E
  80. static int ccnt = 8;- p9 E% h9 P- M& q' X

  81. * }2 {4 G# t0 x0 }- J# T
  82. module_param(acnt, int, S_IRUGO);$ X" i3 M9 K" V& `+ m, X
  83. module_param(bcnt, int, S_IRUGO);
    + d# ]7 E' ]0 N6 Q. k$ U/ @1 d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 L, E6 I  p9 e* f. g- R1 b! Y) |
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 a) a$ U/ E$ a6 K0 harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 {3 ^. M9 L' X" V7 V0 P5 m- @$ `
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) r7 v# W9 R% O& n% N- b! O7 R3 Q% }7 ?+ p. ~! m& y3 s9 u) O% V
5 l7 E* g5 B5 @( b2 b# Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-17 12:11 , Processed in 0.040564 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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