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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* @/ p8 q  i+ e6 d% s9 P
  1. [code]EDMA sample test application
    ! V% ?- U7 h) Z: N1 R. h
  2. /*3 X$ J3 Z$ l6 v
  3. * edma_test.c( H; J0 n  b% b2 x' c
  4. *
    ' e" g' I5 K* x# D2 |4 |) J; Z* h1 J
  5. * brief  EDMA3 Test Application
    . A1 {- n. |. x8 ^5 l$ N2 P$ c
  6. *
    4 R/ o) Z; T+ ~& z/ i6 `% v  g% f( Z( ~
  7. *   This file contains EDMA3 Test code.. I% S0 @0 J# h. H' I  V/ X; ?
  8. *
    " ]: F+ V% r, p; n1 x/ o- Q' Z2 t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & d2 k! M' m- }; l( c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: @; q3 K! M- Z
  11. *         TO CHANGE.
    - I1 M' L% s: N7 K3 l. \+ o' N
  12. */ Y4 V, t' W- b! S' h: n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 S1 I1 w2 M/ R6 W% B
  14. *7 d, a$ A! k% W( M9 [2 t
  15. * This program is free software; you can redistribute it and/or
    : e, t$ y6 \: {, w1 G
  16. * modify it under the terms of the GNU General Public License as. ]; ^3 t7 C* ^: P
  17. * published by the Free Software Foundation version 2.
    2 J( h( X' h/ R" p' g
  18. *! w( D8 u2 ?$ @2 D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " o; k# H! P5 G9 I4 B, ^
  20. * kind, whether express or implied; without even the implied warranty
    6 i% X; O8 O6 l' R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  U- B/ }  \) W7 j
  22. * GNU General Public License for more details.! B4 E4 ]5 W' ]0 h( a
  23. */
    4 n& M; q2 i& K
  24. ) u) {" c5 A, X! X+ }! o8 \
  25. #include <linux/module.h>6 T. Z+ R& O/ U- o: W) L, V" y8 f. G# x
  26. #include <linux/init.h>
    " L8 E0 D6 s: Y! d2 r
  27. #include <linux/errno.h>* K) I4 B/ f/ q5 h& t9 c$ t
  28. #include <linux/types.h>/ d& `! E, X- ~# o$ K6 c
  29. #include <linux/interrupt.h>) t' w$ M, Q) r7 k  J! D( r! ^# b
  30. #include <asm/io.h>
    ' I5 J0 ?8 j/ A& `- ~& w7 ?; E# }
  31. #include <linux/moduleparam.h>8 _' Q. G9 p1 s4 \2 ?
  32. #include <linux/sysctl.h>
    ) x$ n9 q$ j* |7 ]5 F
  33. #include <linux/mm.h>& Z) x$ i% l; J' d: p
  34. #include <linux/dma-mapping.h>
      }! p" I5 {6 z- ~' Z

  35. 7 b7 a& T$ l1 f- I* j$ V
  36. #include <mach/memory.h>
    0 w0 C7 z: @1 I
  37. #include <mach/hardware.h>9 s4 `5 z5 ~7 J
  38. #include <mach/irqs.h>
    : d' F0 j6 i+ }5 X' ]  y  u
  39. #include <asm/hardware/edma.h>
    9 e2 \) n3 W" |* q) d

  40. 4 p- h6 q# m" j$ z# l
  41. #undef EDMA3_DEBUG( O  Y! z- ]8 f; i
  42. /*#define EDMA3_DEBUG*/# ?( ^' i; C8 l. R

  43. / C& B9 d" O8 _/ y
  44. #ifdef EDMA3_DEBUG" S' ?) R9 _9 Y" A$ J# ~$ x3 J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 i5 d0 M3 _" K/ M3 B$ F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & B) y# H& L9 }- T8 N& R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & D' @9 {  m( x: ~
  48. #else
    5 b& T& o/ N$ \$ G9 _
  49. #define DMA_PRINTK( x... )
    , J$ i' ~. r" X4 z1 w
  50. #define DMA_FN_IN9 ?3 ?9 y0 [- g# `1 n0 N! J
  51. #define DMA_FN_OUT
    2 r9 m4 X$ A9 X% \8 o
  52. #endif, x  r2 T# B/ N- @# W) O
  53. ( b; E( k2 \; f, E7 `/ }/ K+ y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 W8 t9 a& Y' m/ Q% C1 @% P+ E
  55. #define STATIC_SHIFT                30 Z( M1 N; ~3 h+ e1 {4 `
  56. #define TCINTEN_SHIFT               20! \+ t+ a% o$ @2 t
  57. #define ITCINTEN_SHIFT              214 b5 B7 ]' r1 _
  58. #define TCCHEN_SHIFT                22
    2 N& d. n, Z! ?0 A2 g
  59. #define ITCCHEN_SHIFT               23# N% v$ N1 X3 f5 U5 T5 Z1 I* R
  60. + c+ v1 T$ Q0 {
  61. static volatile int irqraised1 = 0;
    & T6 t! L& R- I7 L3 ^* e, l
  62. static volatile int irqraised2 = 0;
    - P4 |4 y( f7 K* j+ {
  63. 4 A$ F9 G- e: l# _1 R: t) _7 h8 D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      M! `6 s" c8 S1 B7 S+ j0 o: K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 A$ z# P$ y7 j  L- i. S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, Y  c- K0 z! x" J# C! N! N8 D1 U

  67. # J: ?/ L; f3 R* [* D" p; N* y
  68. dma_addr_t dmaphyssrc1 = 0;$ C7 B4 i3 W) a0 I- K& T
  69. dma_addr_t dmaphyssrc2 = 0;) R! P, q+ O, R' R8 n
  70. dma_addr_t dmaphysdest1 = 0;. j( s8 _$ |, X' P1 P
  71. dma_addr_t dmaphysdest2 = 0;
    1 {3 `2 ~+ [- Q* x3 `) }, R  C1 p
  72. 4 u; @  i. @4 x4 Q7 V
  73. char *dmabufsrc1 = NULL;
    / M# f" [8 h9 C% u0 }6 z
  74. char *dmabufsrc2 = NULL;( z! [9 m2 Z: Y
  75. char *dmabufdest1 = NULL;. e% @. G( q. W1 B5 D9 A
  76. char *dmabufdest2 = NULL;
    9 \4 z% |; c, F5 A

  77. 9 v+ e! n0 D* r) o0 b
  78. static int acnt = 512;9 @$ e$ S9 U# r0 u
  79. static int bcnt = 8;$ S' O4 i+ K1 K5 K; |
  80. static int ccnt = 8;9 P1 w% N% d' B1 N  u( B3 g" _( r

  81. 9 z( J. h" M6 {% B3 M6 _$ q4 b! H' @
  82. module_param(acnt, int, S_IRUGO);+ x( ^3 Q9 v- c+ `4 i+ @/ u
  83. module_param(bcnt, int, S_IRUGO);
    - X0 S3 V# i1 ?, Y8 O! e" ]. g. K' s
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ i( b$ f4 L& l( u% n+ \

2 g# i) t/ i8 ]; M  M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ q: V0 d: ~7 u6 g/ {- n4 @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& T2 r4 O; B. V3 E& [
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 Y8 e' h1 M* r- ]; a% q
  k0 v, J7 [' k' f, z& H- ]* q6 S# L5 e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-6 06:26 , Processed in 0.040315 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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