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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, E& l' Y, p& l0 H/ Q3 c
  1. [code]EDMA sample test application$ ^  P5 S" i5 c5 D' N8 E  D' \
  2. /*
    1 D8 c, f% ?- Q: U: C& H2 Q
  3. * edma_test.c
    - H* q2 }0 H0 z( i* j9 n8 J0 G, ?& [) _% O
  4. *
    / G% b3 f* G, I) w4 V( l; e
  5. * brief  EDMA3 Test Application: O) t( f7 j$ o' E: {! F. C
  6. *
    & t! L$ ^1 d) e3 q+ ~" b1 R
  7. *   This file contains EDMA3 Test code.' m3 |0 `+ f+ x, _' w
  8. *" J7 A3 L% a' O# A  z) f. `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% N& z( E" x) H: N/ H3 S( F2 k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# Y6 z5 O7 n7 d0 ~# e
  11. *         TO CHANGE." Z1 Y) @& s" H
  12. *
    6 e6 |# `; X( ~" o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / v/ M( J9 ]+ U! V8 A$ f" C6 i8 t
  14. *
    8 a7 I" Z1 `' ~$ D" I- ?
  15. * This program is free software; you can redistribute it and/or9 u8 H& w6 o0 `. ~  `
  16. * modify it under the terms of the GNU General Public License as
    3 X; ]* N. X! d& r9 \) P8 b
  17. * published by the Free Software Foundation version 2.
    5 L: L/ c6 t/ ?# S6 w) n% [. y
  18. *
    6 D3 x! B- P: F" N5 ~; M% a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! O- |, G" Y! b) `6 |9 n& i, U
  20. * kind, whether express or implied; without even the implied warranty# F2 {* I, z1 ^. c6 p0 C1 S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, o& ^# Q2 m" D- Q7 T. a
  22. * GNU General Public License for more details.9 G8 P9 `: r7 [$ x
  23. */9 v" N% r+ Z+ N: V: ~1 |0 i
  24. - c* u) Z8 G8 |4 l
  25. #include <linux/module.h>
    1 O' m* O, K; p
  26. #include <linux/init.h>" \7 @. i( s0 D% U
  27. #include <linux/errno.h>
    # [# N% `: ~6 D- c
  28. #include <linux/types.h>; @( B- N. V; E
  29. #include <linux/interrupt.h>3 C6 |; G8 z) V0 y: n& w
  30. #include <asm/io.h>
    6 C3 ?9 g$ e7 c; I( L% r
  31. #include <linux/moduleparam.h>
    , l, E( r; h4 R# D) _: p; \
  32. #include <linux/sysctl.h>
    : [3 {& v$ A2 ^: \4 D/ s
  33. #include <linux/mm.h>
    & `" @" a$ S4 B: W
  34. #include <linux/dma-mapping.h>5 c1 H: Y: C4 _! k2 z. u
  35. 8 T/ E8 _5 j% u( {. ]  r& ~$ i
  36. #include <mach/memory.h>
    9 j' n: I+ |6 j: F. l% H2 ^
  37. #include <mach/hardware.h>5 z, u0 z6 q, z4 o( Q5 j
  38. #include <mach/irqs.h>* z- D2 Q' i* J) ^, N! C& |8 @
  39. #include <asm/hardware/edma.h>! O- ~2 r! q5 J: J

  40. / z) O( D" L, c- m' ~7 P$ \
  41. #undef EDMA3_DEBUG
    * j3 f4 w  `) r% g0 [
  42. /*#define EDMA3_DEBUG*/
    4 g) g7 Y9 ]2 v! y; y
  43.   S6 {% L' d0 H$ [5 u/ r
  44. #ifdef EDMA3_DEBUG7 A) X' t* c% J0 b* c) M8 D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 g3 S, g! \: I% _" e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; A: X& }8 q: z% }7 V% C* e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % [3 x* B3 z, n
  48. #else
    & ~- m( t5 H! A* {- H
  49. #define DMA_PRINTK( x... ). R5 ?3 R' M3 m. E8 ~3 b
  50. #define DMA_FN_IN
    " u# Y6 T# }3 x/ T9 j
  51. #define DMA_FN_OUT
    1 C$ D2 O0 k0 ~; t/ Z6 D4 ~
  52. #endif
    6 U6 a0 G( s, c  u, X9 q1 ?- y
  53. 5 C( T$ p+ ?6 V$ J2 P% r2 f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , ?5 }7 b' ?; ^  m/ X
  55. #define STATIC_SHIFT                3. r! s- ^4 w; V8 Q
  56. #define TCINTEN_SHIFT               20. n% ]: Z2 y' i+ k$ k& M9 n: V/ ]2 J
  57. #define ITCINTEN_SHIFT              21* G, P0 {3 _9 M, a# h% H/ k
  58. #define TCCHEN_SHIFT                22
    5 Z% |3 q( I4 i9 b
  59. #define ITCCHEN_SHIFT               23" H$ k+ G: @/ n8 h( O

  60. , r; j6 S& P5 r" }7 i" j' b
  61. static volatile int irqraised1 = 0;& M8 F# C9 U2 ?
  62. static volatile int irqraised2 = 0;) k: i" Q* y$ f' V( J) o2 G( @( R2 d

  63. 8 {. X; f8 s3 W7 J5 h! w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 O2 G1 g1 V, c# z9 R3 D6 p6 R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' ?6 f- S# W! z. y8 B3 @& M) z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 I4 ]% ]0 i( O- h0 r  P, l

  67.   C8 w0 d: P" {4 j
  68. dma_addr_t dmaphyssrc1 = 0;
    & ?' L, k6 C7 w, L( [2 G3 ?) i9 g/ s
  69. dma_addr_t dmaphyssrc2 = 0;
    / v" s% H1 e0 {- m3 b: `
  70. dma_addr_t dmaphysdest1 = 0;
    4 L' W% h& d9 K: x; @
  71. dma_addr_t dmaphysdest2 = 0;2 p/ _- j/ m6 a) l& a

  72. * N5 n4 }: C% J0 B+ ~# x+ r, C# q) v
  73. char *dmabufsrc1 = NULL;' n) a% I0 U/ M) U
  74. char *dmabufsrc2 = NULL;
    : I8 ~6 r0 ]% u  Z  y
  75. char *dmabufdest1 = NULL;, g& k8 n2 c  c) n2 R
  76. char *dmabufdest2 = NULL;8 e) _% H6 a4 U! _

  77. ; o1 @) t( P5 d- o0 t$ j
  78. static int acnt = 512;1 Z8 w- N0 }  ~+ A2 F; N
  79. static int bcnt = 8;5 O2 s% E; S* a2 P, Z" f
  80. static int ccnt = 8;
    ' L7 l" F. M0 c
  81. ' _% c2 y( a8 L: m) o) T% Y
  82. module_param(acnt, int, S_IRUGO);
    # ?2 X( D4 M+ ?  k6 g8 j& \. ?
  83. module_param(bcnt, int, S_IRUGO);
    4 A: _$ z, F" Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 x( Q3 z0 G' e
( ~3 E& r% ^. q- Z# r( @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 A8 I0 K5 O" b: P6 C  Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# N) z' G& \$ M# F$ d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 z: F  i) z! j1 a2 w- d: I5 \
- _& A; R! ~! Z* O* c

( F5 n6 p* J$ s0 J: s1 S# U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 16:15 , Processed in 0.041259 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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