OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- H8 m2 M% Z& w# `6 A
  1. [code]EDMA sample test application' I4 F8 ^0 U. _0 b
  2. /*
    # A- r4 C8 x0 c/ B
  3. * edma_test.c3 L3 S; {* L* z# J) q' ?3 y
  4. *
    , Z& u* {5 F: C
  5. * brief  EDMA3 Test Application
    & w+ ~  t/ F' x+ n) X  ?6 d
  6. *
    # D4 _. {$ i- s( l) {: D
  7. *   This file contains EDMA3 Test code.' M+ o  y, {% q* T
  8. *& _3 E+ w1 W- v1 d( N, t% I- w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ d5 |$ B: |* L* a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' |0 z, Z, e: V+ U  e/ o- b9 }) G
  11. *         TO CHANGE.2 z/ K- N5 V- \: c$ J' d: `: t6 f
  12. *
    ; H" n5 \5 F+ y4 n& E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 w; j" L0 ?: ^* J* {& ~
  14. *
    3 d8 M  Z1 G1 ]8 b$ ^2 C+ Q9 c) @5 w
  15. * This program is free software; you can redistribute it and/or" b% Q5 g$ {9 A& H
  16. * modify it under the terms of the GNU General Public License as
    7 p) y& {5 l9 l& [( O
  17. * published by the Free Software Foundation version 2.+ j4 t  |2 O# u& J
  18. *
    , M$ c( s* e3 e" l' F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 S2 O/ _* h7 T' n7 K0 {
  20. * kind, whether express or implied; without even the implied warranty  Y3 b6 e8 w4 u0 T( L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& J; p# N. Q0 `7 J- s% o0 S
  22. * GNU General Public License for more details.
    ( s; B8 e( f$ q
  23. */6 b: a  Z8 H* i( y8 w. Y4 d

  24. 5 s# \- j- S: M
  25. #include <linux/module.h>+ G) _6 _) B# s
  26. #include <linux/init.h>& z; P( a( K8 \, ~4 C& }; n$ ?
  27. #include <linux/errno.h>
    / s/ J6 t  g9 m1 G
  28. #include <linux/types.h>; v" p( K' {8 ^  _4 Z" }8 k
  29. #include <linux/interrupt.h>
    ' K9 ]3 t! @* C. k# h! s
  30. #include <asm/io.h>
    3 L& s2 a9 U4 F6 Z
  31. #include <linux/moduleparam.h>+ u4 E1 V& J7 @/ n! i: d# n
  32. #include <linux/sysctl.h>
    , ?- I/ D' q) y' B' \" B
  33. #include <linux/mm.h>
    ) N! w. @3 ?9 {& o- b3 e0 j# e: A
  34. #include <linux/dma-mapping.h>; F( R; ?- t; W3 q4 _# v
  35. - K: h3 H5 }8 c% e/ i
  36. #include <mach/memory.h>
    % ?5 F! t: r+ K6 r9 N( H' D* J
  37. #include <mach/hardware.h>" [" F5 l- K  T8 Q5 d, ]
  38. #include <mach/irqs.h>
    % N. a4 h$ Z6 i6 S4 F, w$ P
  39. #include <asm/hardware/edma.h>9 g' o+ N; G6 c4 B8 g* D

  40. 0 v$ }7 t9 ]- Z. E: s' o/ N+ W5 |
  41. #undef EDMA3_DEBUG
    & {! e$ k- u5 W" t7 D
  42. /*#define EDMA3_DEBUG*/% K# g% g$ T$ N3 {3 v1 P& D* E
  43. . E; j- l. j  ^* V6 h2 V( J0 c
  44. #ifdef EDMA3_DEBUG
    # {$ v9 n0 I0 c. t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 t: k6 X) ~, F2 W4 b0 x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) Z7 F* F) v* B% d  l; ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 ]& F% A% c5 K. t. Q0 n6 R
  48. #else# P4 ]4 t, W7 V: M
  49. #define DMA_PRINTK( x... )
    + U! b- `. ?6 |: u* _
  50. #define DMA_FN_IN* a0 y  \+ @1 v) c0 U$ ]6 g
  51. #define DMA_FN_OUT
    * ?6 ?( `, b0 s4 }: O. ]
  52. #endif
    - m0 e# `& b3 M) Y% x  v3 Z" ~
  53. ( x. R, N( V) t0 s  I. {) S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& ^1 f. L0 T0 v2 @3 r, ~, {( ]
  55. #define STATIC_SHIFT                3$ U1 x$ l$ g4 w" Z  w* m
  56. #define TCINTEN_SHIFT               20# _) v: [1 Y; T
  57. #define ITCINTEN_SHIFT              21
    + H4 F1 A, Q) E! C2 l/ }
  58. #define TCCHEN_SHIFT                22
    # Q. _9 @4 D$ Q, x4 i6 r% I4 y
  59. #define ITCCHEN_SHIFT               23
    5 L) I1 ~2 s) R5 [$ i1 M
  60. ( e7 N- i8 f6 x7 g
  61. static volatile int irqraised1 = 0;
    % O& ?8 W) \5 W2 ?/ o+ u
  62. static volatile int irqraised2 = 0;+ _8 d; Y& x2 s1 N1 ?
  63. 2 K% Q4 l0 y& F, S; K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( |: w! ]* v- `. J- c# ^6 V% K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % r$ k1 g" ^/ h* w- ]1 |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 [. O5 z' _, `; D; Z6 f
  67. ' s: ]' S5 v, P+ c
  68. dma_addr_t dmaphyssrc1 = 0;' ~; s' b) \) ^  \
  69. dma_addr_t dmaphyssrc2 = 0;. K- U  R' g( v
  70. dma_addr_t dmaphysdest1 = 0;- r& P. j6 i$ Z8 j
  71. dma_addr_t dmaphysdest2 = 0;. y% f' G; n9 M0 m! T+ y' x; M
  72. , ]+ I! H) Q, g: L
  73. char *dmabufsrc1 = NULL;6 s7 `7 t! |+ A5 d% y1 T1 K
  74. char *dmabufsrc2 = NULL;
    " z, G: |; A7 A3 ^' V- I- W
  75. char *dmabufdest1 = NULL;5 [; k0 S. C& D) I8 a  P
  76. char *dmabufdest2 = NULL;6 D9 [( f( u5 Z, a) o# S- f
  77. 0 P0 X# O4 ~( |  h- _/ Y
  78. static int acnt = 512;0 C0 [5 Y5 F1 D' ^
  79. static int bcnt = 8;
    4 k' t# Q% Q6 T; x9 c* N# I
  80. static int ccnt = 8;- M) i" Y: i/ c0 T8 \

  81.   o( b& K2 D$ t, C9 i8 F. s4 M
  82. module_param(acnt, int, S_IRUGO);
    & v, n1 \; w" J3 s/ Q8 F5 s
  83. module_param(bcnt, int, S_IRUGO);/ n: {9 G: L4 D6 p4 X
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 {% A' ~- V7 d1 L' y$ a5 b
' B! U- K# o5 F" t8 W0 B% m
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# O* a' |4 d. V1 k1 f$ Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 {! R% i' e8 H8 K& D
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( `" b. h* g/ @( G$ e

4 w" d5 C- C8 ?
; \+ w* N' F& m8 |0 W4 {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-22 09:10 , Processed in 0.037358 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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