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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - C4 W* {: b) @1 m
  1. [code]EDMA sample test application- j6 w7 q  l) ?
  2. /*4 W+ `( }$ _+ ~
  3. * edma_test.c  d$ n9 m3 Y7 z
  4. *
    ; w" ]' k# i" j! E% x" P9 L  S
  5. * brief  EDMA3 Test Application
    , V& _0 z1 Z/ D& l# f
  6. *$ s9 W6 h8 }! H1 J4 p
  7. *   This file contains EDMA3 Test code.# e, H8 j0 m9 [
  8. *8 A( Z5 b; u8 |* ?+ T7 E2 W( S  |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' S9 ?4 N' g! z! q4 z1 v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 m. |- l. E2 L" F! j& u6 Y$ O( A
  11. *         TO CHANGE.
    7 z& `2 I5 i, F/ F7 b
  12. *
    : W8 U6 O7 G) A) x* i2 k; d# H9 }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 N! J$ R  w4 e5 ?% B( m
  14. *
    6 t- Q  j; G+ V6 o  O$ }' P
  15. * This program is free software; you can redistribute it and/or
    % S' v: J* _6 a* d! J' L/ M
  16. * modify it under the terms of the GNU General Public License as5 K7 `" G: j) J( B: m' O5 {+ p/ Q  y& R
  17. * published by the Free Software Foundation version 2./ `; K% Q* D5 K+ ?
  18. *
    ! R4 E& U+ [  m/ e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( `' T& X; J* A7 Y2 r) m+ P
  20. * kind, whether express or implied; without even the implied warranty6 f6 M6 J& y) b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% Z* M8 q0 V- [+ ]9 I
  22. * GNU General Public License for more details.2 @) W% l; d# G
  23. */- [4 Q2 f4 z9 x6 U

  24. ) R4 B5 q) M" K  L5 w- [/ I
  25. #include <linux/module.h>+ N) D" g: u. S# ^
  26. #include <linux/init.h>4 J& D" n5 I3 M8 @
  27. #include <linux/errno.h>: y- m" r" a  r  X
  28. #include <linux/types.h>5 u1 Y; N$ p/ b
  29. #include <linux/interrupt.h>+ a) g9 C: `  L- K# @& k5 U% l
  30. #include <asm/io.h>( n3 L7 B5 g) W3 a
  31. #include <linux/moduleparam.h>
    " K. T* B' S! U' O. M  f
  32. #include <linux/sysctl.h>  z: A' _1 k) _
  33. #include <linux/mm.h>3 l2 _# Q: R4 R4 H
  34. #include <linux/dma-mapping.h>
    ! p% Z/ u1 t4 Z5 |
  35. 1 L6 K; P" {' E
  36. #include <mach/memory.h>" Q1 i4 o. a" i; l# W$ N
  37. #include <mach/hardware.h>. g: P8 W  Z2 c+ w( p$ {
  38. #include <mach/irqs.h>
    + \8 X' a  g1 z" A4 a' y; u5 W
  39. #include <asm/hardware/edma.h>
    " f  f  f7 \. C* }2 I: D
  40. - Q0 K6 Z% p" i' k1 `8 g& x# N0 @
  41. #undef EDMA3_DEBUG
    ! ?( g) D4 k! P( E# l$ o
  42. /*#define EDMA3_DEBUG*/
    7 E" {- U3 Z+ C, s' l* A
  43. % ^( g: ?$ E8 o. N' e
  44. #ifdef EDMA3_DEBUG
      o7 X" L) R  T# ^  g6 y7 k! n" q# r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# q, Z, y# n9 I4 v% n, }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 F" F5 s6 i* k5 Q/ `% G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! s; W, H! d5 T5 v
  48. #else* q1 Y( E& R$ P7 }2 Y% {
  49. #define DMA_PRINTK( x... )
    0 J& G) M5 R/ x% s3 H
  50. #define DMA_FN_IN6 o: [7 o2 \- s1 o
  51. #define DMA_FN_OUT3 E1 _$ W  A2 U" G2 a# W
  52. #endif
    7 K) b9 b- E1 p6 ?6 ]- ], }
  53. / I8 d0 T7 E' T7 s5 x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 \# r7 |4 Z/ f7 y' ?8 u8 Y
  55. #define STATIC_SHIFT                3
    . }$ F0 k/ t& I, Y7 J$ V
  56. #define TCINTEN_SHIFT               20
    ! ~2 p) ?; q) C' Z" c
  57. #define ITCINTEN_SHIFT              21
    - p- b$ Q% h4 h8 t  S2 Z" |  v) r' ~
  58. #define TCCHEN_SHIFT                22
    * u3 r3 X. ~8 e. e1 o" b
  59. #define ITCCHEN_SHIFT               230 c! J' s6 i6 J: T

  60. 7 m5 y7 N7 {1 K% C4 Y7 {7 |
  61. static volatile int irqraised1 = 0;
    & ?, ^3 o4 A  ]$ {
  62. static volatile int irqraised2 = 0;
    8 o5 _2 g2 i6 _0 q( O
  63. " w! _% U" ?# U, N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " F4 R. k) d! M! D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " G3 i/ q+ s% N) J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 v; i, O( Y* [+ _/ v3 |3 X
  67. : [, z. M+ C0 R6 C2 m
  68. dma_addr_t dmaphyssrc1 = 0;
    ( x+ z: N! U. t3 d6 T+ J$ G
  69. dma_addr_t dmaphyssrc2 = 0;+ L7 p. `2 S: g% O0 g- q6 [
  70. dma_addr_t dmaphysdest1 = 0;$ B& A3 z; {: g2 E, `% C& B
  71. dma_addr_t dmaphysdest2 = 0;2 ?8 T0 f( G9 \( R5 L' ^) q

  72. + r' N' c+ H6 t. ~8 R' q
  73. char *dmabufsrc1 = NULL;
    0 K' }# Y/ v4 F  K  ~
  74. char *dmabufsrc2 = NULL;
    5 d, @% m* W2 h! @1 ~6 B. a, V8 q
  75. char *dmabufdest1 = NULL;0 C% h, R7 `* s: R- s' z
  76. char *dmabufdest2 = NULL;0 V- ~+ N! Z+ r5 @
  77. 6 _8 v& c$ |1 [5 L: _
  78. static int acnt = 512;
    + {  y5 H& q/ U2 i
  79. static int bcnt = 8;: O% o9 W5 o: E
  80. static int ccnt = 8;) ?, I# t9 l* W

  81. * q3 J1 D$ L1 U( l6 ^4 t5 e
  82. module_param(acnt, int, S_IRUGO);% {( C# M# U% z3 x4 J  n* O
  83. module_param(bcnt, int, S_IRUGO);2 ^5 t: Q7 \. a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 J( R$ o# M5 K; ~& Z6 o4 ?& ?- E- A3 I6 J/ O+ O6 }* M8 }
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- _9 r! n6 z. ]+ }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 O$ @) ]3 R2 g, q7 Z3 a     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ r5 D( N% W( p0 ~% `4 B3 a$ Q, h) e0 i3 `2 G. R7 }: ]
3 F* p9 ^* H- k/ m8 l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-6 04:32 , Processed in 0.043532 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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