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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - C! R6 f5 N4 b( S
  1. [code]EDMA sample test application0 L) S$ [( F( o- R7 A, c
  2. /*
    ; R7 D! N) s' A, B2 f
  3. * edma_test.c
    - j+ }* C) T- m
  4. *
    ; x' f7 u! F1 [, ^
  5. * brief  EDMA3 Test Application1 W+ p! r2 P5 R+ M9 ^1 E+ P* P
  6. *8 g& d$ o' z9 {. ~
  7. *   This file contains EDMA3 Test code.
    ( w/ M( c# D+ |# e* P0 M' T* `
  8. *
    4 f% c$ V& w6 q4 N* ~/ V2 [! @8 T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% V) E$ i3 z& v: V! w" f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 D' n& \, n% ?/ \5 k
  11. *         TO CHANGE.
    2 k4 Z9 s( f0 M* [4 n% S9 f7 V6 E
  12. *9 u8 M# }. L+ ~' f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 `( E  z8 ~* u9 z& T3 j* ]: H
  14. *
    ( h( @8 ~4 r8 T0 W7 t
  15. * This program is free software; you can redistribute it and/or
    & B$ }* m/ j/ c! k0 }) w
  16. * modify it under the terms of the GNU General Public License as
    - C5 v( i+ W7 Y7 I
  17. * published by the Free Software Foundation version 2./ w6 M. m5 X$ Z) ~
  18. *+ L1 ~. y6 x: V2 G7 {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      l" b; a" ^1 R8 @7 }
  20. * kind, whether express or implied; without even the implied warranty- R) R. ?; m3 b0 d% J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 u, _! v8 _: v' J
  22. * GNU General Public License for more details.
    3 ~' w5 C* H" W8 v3 W
  23. */
    ( {2 F! t+ L2 V# ^3 R5 G6 a
  24. 7 ^, X. U5 L+ Y
  25. #include <linux/module.h>
    " f7 j' V) Z' r  I. M4 J
  26. #include <linux/init.h>5 y, P! _6 G$ o6 M' O8 L' j
  27. #include <linux/errno.h>4 Z" o, b6 M) U1 x& ~$ E5 u
  28. #include <linux/types.h>
    - D! Y# A/ w0 x3 G2 G+ s) \
  29. #include <linux/interrupt.h>- m. P0 d6 [& H8 o* U
  30. #include <asm/io.h>
    % _  i# g& l8 _; t" t; L: z# N
  31. #include <linux/moduleparam.h>
    0 L4 d! f) S. T- U' k! B! H+ l
  32. #include <linux/sysctl.h>
    . \8 p( F" p& t  ~
  33. #include <linux/mm.h>; g" b; w. t3 v0 g3 C
  34. #include <linux/dma-mapping.h>7 g' w5 T" o9 y! E9 E- N
  35. * r5 k4 _' J% d; _. J5 }
  36. #include <mach/memory.h>
    4 \* x: ]: m+ k+ R  L! j
  37. #include <mach/hardware.h>
    7 G9 b% H9 s3 k! l. m; `
  38. #include <mach/irqs.h>. Q  Z! l. T  X& h# s4 T( d
  39. #include <asm/hardware/edma.h>2 z: q; s4 d! n: w9 `* a- Y
  40. # [2 E" ]  Z0 b# X
  41. #undef EDMA3_DEBUG$ j1 Q5 c3 H- I# X8 n# L
  42. /*#define EDMA3_DEBUG*/  H, P$ q6 U+ U8 Z' Q! p8 S

  43. ' N6 J; [6 s, d; ~. w
  44. #ifdef EDMA3_DEBUG
    % V8 w4 X/ J  I, S8 g9 K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 V( R; {$ J; ~: L. Z' E% E- y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ O7 Y3 X! u3 w( s8 Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% s. Z1 H% g6 q# C- I  D- U0 M
  48. #else' }9 S7 }% t/ T$ W5 `4 ^0 g
  49. #define DMA_PRINTK( x... )- j) L3 ?; g  N/ G: |
  50. #define DMA_FN_IN
    4 m. e) O3 Q; i5 x
  51. #define DMA_FN_OUT9 ^2 N& J7 U" V2 _; K. _7 A) j
  52. #endif6 W9 h# F# a# v: a

  53. $ P8 f4 A1 n, a8 S* n0 l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ `" z. e) m+ j+ v- x
  55. #define STATIC_SHIFT                37 u* E$ h7 O- B3 q8 ?6 z
  56. #define TCINTEN_SHIFT               203 ?) E) q4 V& ^0 Q3 M
  57. #define ITCINTEN_SHIFT              21: a9 i( c! I: H! H1 [/ ~# Y: B
  58. #define TCCHEN_SHIFT                22
    $ f5 `. P5 D# ~/ ~' A: R# a! s
  59. #define ITCCHEN_SHIFT               23
    2 d# T, S* R7 f0 g- I. X

  60. # k% K4 L6 f, y" e4 i8 J
  61. static volatile int irqraised1 = 0;# y9 {; S2 @0 ~# T2 d. E
  62. static volatile int irqraised2 = 0;
    . ?  ?4 \' w1 r0 H

  63. ( ~6 L$ F( v" N. r+ P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 A1 q- q6 i. F  F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 r5 P/ S. Z! L* [! N& E; ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 T1 X- _( h1 B$ k0 Y& g$ v/ q
  67. % A6 }; S" v4 D/ w2 z
  68. dma_addr_t dmaphyssrc1 = 0;0 S7 u9 q% |( @+ ?8 c
  69. dma_addr_t dmaphyssrc2 = 0;
    & V" o, i$ v5 d  J9 |
  70. dma_addr_t dmaphysdest1 = 0;, j+ S6 B+ N6 ]' L4 D
  71. dma_addr_t dmaphysdest2 = 0;
    $ V7 R8 ^/ R% E1 I+ }/ P: n2 O

  72. ; ?" S$ X: m/ _7 V% o+ Q, i6 t" c
  73. char *dmabufsrc1 = NULL;
    ; |. J, T0 O  a" o5 }
  74. char *dmabufsrc2 = NULL;6 |  l1 n" C2 a" z% Q; }
  75. char *dmabufdest1 = NULL;& [' E9 @' x: U3 }
  76. char *dmabufdest2 = NULL;
    ' N  ?1 D! C3 j" h$ B5 I) W* L

  77. 7 `5 k4 j2 f8 o1 C' T0 X" ]8 l
  78. static int acnt = 512;
    % g, a, W8 C, L3 v, M& p7 n# Z
  79. static int bcnt = 8;
    $ s% W+ E2 a# |
  80. static int ccnt = 8;* I3 C4 J: ?/ k: h5 ~

  81. 8 ?# u* v$ F& p2 B
  82. module_param(acnt, int, S_IRUGO);
    ' e- `( B" v4 d9 x' @3 m9 r  W
  83. module_param(bcnt, int, S_IRUGO);" f8 L+ A9 x6 z3 m- H1 H
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) _( V  L  Q. J" v  `# V1 l+ u
' [7 x0 {  A# [/ [! v+ _: D+ G8 @7 J      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( V: ]7 O/ }$ n1 K: y5 R7 D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) A- D9 |9 x$ n. ?8 O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 I/ \, Z; Y2 u. n5 U7 K1 A6 |3 R

& h, P0 B( M+ {1 o' E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 07:55 , Processed in 0.039676 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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