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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 i1 q  d, f( R! Z" h8 M
  1. [code]EDMA sample test application0 w. ^. q9 C. U9 H( x0 D; @
  2. /*
    6 s, Y( t$ I" ^3 i5 K8 [5 c
  3. * edma_test.c( A7 X# V3 P8 R; P+ d& e9 ?
  4. *
    1 |0 {3 }/ a' n0 ], u/ P
  5. * brief  EDMA3 Test Application
    & \) f' L- u- E
  6. *% s3 v! s$ y6 Z6 _" E5 Q" d! f
  7. *   This file contains EDMA3 Test code.
    + j  g9 a4 K) l1 ]
  8. *1 h$ }, V# {. r& P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* i' Q1 t8 X% V" t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 {! G& T8 _  B2 o! ?* J) y( Y
  11. *         TO CHANGE.
    ; e* `' y& b5 j& w( F
  12. *, |! d: W2 K8 H7 E6 n+ h3 s2 S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 p9 A% }5 Q( d) B5 p8 j
  14. *2 `5 _4 `/ g; c% s) g. q! Z
  15. * This program is free software; you can redistribute it and/or
    7 O4 H; s: i& K4 m; E0 q2 A
  16. * modify it under the terms of the GNU General Public License as
    0 ]; h8 m# J4 b( q% H% v
  17. * published by the Free Software Foundation version 2.& v- F% Y- s3 ]! |2 }2 B/ L$ T
  18. *
    & Q" j$ j1 z1 b$ b9 _( B0 v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 O& K- o! J! {# o; ]2 Q8 H6 J
  20. * kind, whether express or implied; without even the implied warranty
    ) }' `: B4 S3 ~7 U- T4 I$ V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! e5 r4 m: y  ^* T7 C2 G
  22. * GNU General Public License for more details.
    : v" J8 b" q1 r6 J3 C
  23. */
    5 `$ z& N6 e6 B, O$ A1 m

  24. + l4 o% ]/ J  {+ C- {
  25. #include <linux/module.h>; Q( \8 d3 x' f( X8 C/ S
  26. #include <linux/init.h>. I. N; b3 \: {) R" y
  27. #include <linux/errno.h>" Z* \. R9 m, U' N; z! u
  28. #include <linux/types.h># W3 b( ]+ [" D2 D# o
  29. #include <linux/interrupt.h>
    8 G  E! _9 s- b
  30. #include <asm/io.h>  @# o4 }; U2 k0 v* h2 M7 |# p
  31. #include <linux/moduleparam.h>
    ( K' s6 d0 B; Q" V+ i; L
  32. #include <linux/sysctl.h>5 }8 R! G) r6 u3 ^% p7 n$ ~
  33. #include <linux/mm.h>- _0 S% U4 n* I
  34. #include <linux/dma-mapping.h>% Z; W- ~" ^' [( g: I  s& I9 ^

  35. " d4 I7 N# X0 f& @# t' g+ \
  36. #include <mach/memory.h>0 F; L. N: w5 w1 g1 ]0 e
  37. #include <mach/hardware.h>
    ! ?# h2 X8 C* s5 ]6 ^+ J9 b/ F
  38. #include <mach/irqs.h>3 Q1 n- C( {/ O$ b3 f% H
  39. #include <asm/hardware/edma.h>2 }& M/ i2 h* g! }3 N" |4 q
  40. : D) W: }+ g- v% J' ?- U8 G
  41. #undef EDMA3_DEBUG9 \5 L4 ~: ~; @8 a3 a! ?
  42. /*#define EDMA3_DEBUG*/
    - \* [$ N* D1 W

  43. 2 P4 N; C6 W7 X# `; M9 I! x
  44. #ifdef EDMA3_DEBUG. L; T. {' i( H( Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) y2 x- J# c, f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : b3 w/ X$ H7 z1 [3 J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% c9 _  h9 n6 W& z8 H6 h/ t
  48. #else; n! f* b4 p4 ^& J$ K5 ]4 l% d& `9 b! g2 O
  49. #define DMA_PRINTK( x... )8 `- ^) @9 u9 _$ \: E
  50. #define DMA_FN_IN
    + l& M1 ?: I1 b
  51. #define DMA_FN_OUT
    + K4 [4 P- z: _; _* c; r
  52. #endif) N# h0 l3 ^0 z, P& Y* V5 c& }0 d( b
  53. 4 \: o6 }& B: Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) g5 O0 v5 ?& I5 k- Y9 P
  55. #define STATIC_SHIFT                3
    " q# _( c. G, N% t
  56. #define TCINTEN_SHIFT               209 z& a% u4 g3 E" y: t5 B' N
  57. #define ITCINTEN_SHIFT              21
    ) s+ l1 D- Y6 N" _, n. R
  58. #define TCCHEN_SHIFT                228 x* ]# v: i# O8 v' e
  59. #define ITCCHEN_SHIFT               23: I% b  g" s. Q, J' m# Q" z5 S, d9 z
  60. % D; [4 K$ B$ |& {4 h6 K: F3 c
  61. static volatile int irqraised1 = 0;" V. i0 ]3 f8 D, l( O# r4 _
  62. static volatile int irqraised2 = 0;
    4 o/ O5 D0 q* g0 f; X) R+ n, r2 y( n
  63.   r8 J3 `5 V' l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " x& u) {! W4 [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 s6 m7 v- Z3 \+ V$ h6 P/ m" L* b5 ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 ~5 p' [/ A4 {1 b* s9 l

  67. + _' w, C/ b; ^. h
  68. dma_addr_t dmaphyssrc1 = 0;& g* v, Q* M/ O( y  T% h
  69. dma_addr_t dmaphyssrc2 = 0;. F# s* P* ?7 l7 I3 l
  70. dma_addr_t dmaphysdest1 = 0;
    " b% i3 u$ S, z. `7 R+ _
  71. dma_addr_t dmaphysdest2 = 0;
    4 ?+ F5 _2 F# ?) }& N& W6 f
  72. 1 y" _8 M' q( ]& y& x4 C1 O* {
  73. char *dmabufsrc1 = NULL;
    - |' A! v9 l# f  }
  74. char *dmabufsrc2 = NULL;* I. }. n+ s; t5 J' A' T
  75. char *dmabufdest1 = NULL;" y! p( [$ X1 D0 t2 H! V
  76. char *dmabufdest2 = NULL;
    % z' c7 K7 ]5 p' k( w8 [

  77. 3 s+ S/ n8 ?) e' L- Q* `
  78. static int acnt = 512;$ I( u6 D7 i$ X4 i. I% Y
  79. static int bcnt = 8;( i4 @! j% k. E3 u6 v  l
  80. static int ccnt = 8;& i/ w2 F) A+ H- F) y
  81. 9 ~* m8 E" p% e- b
  82. module_param(acnt, int, S_IRUGO);
    & N" m7 \+ R- I; u4 x+ ]
  83. module_param(bcnt, int, S_IRUGO);
    1 l& a) `$ F1 R- g7 w( {" Q% h
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 O, t3 C6 y4 F, B
7 V' U! G; @# n# Z1 a$ H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 l, X! m: j9 I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 j7 m8 p4 t4 J/ G4 I2 Q9 D  F, Y3 y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 V- @) S& ~. |

( B/ m  ]7 G: W6 d8 `: S- J% H1 t0 Y" r$ t) u& ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-1 03:53 , Processed in 0.043340 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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