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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & W7 C& w0 M2 \$ U; {
  1. [code]EDMA sample test application
    & V0 f0 b. Q  m; @- [1 i5 Y! r
  2. /*% i, j7 R, N# A! ?; W
  3. * edma_test.c2 O9 ^0 {1 r3 F: K/ k/ B
  4. *
    . o! x! B" U& i$ Y) i# D
  5. * brief  EDMA3 Test Application
    1 f5 _  n% n/ \7 |
  6. *3 {- Z- p; U2 u5 i- t5 k& M
  7. *   This file contains EDMA3 Test code.& b( O* s5 V- @/ K) ~, y
  8. *
    & W" Q$ `9 u8 g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( Z) }1 {, u& {6 q: w7 v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , o! t9 A" `( a7 R& U$ _  P
  11. *         TO CHANGE.* s1 j* U! S0 ^, }
  12. *
    ; g! X9 S: m- k' E- a/ G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - b# L) p( C( O# F
  14. *: t/ X6 F5 l( ]( y% O
  15. * This program is free software; you can redistribute it and/or, H0 t! @5 `' w8 V3 X5 v. r6 x
  16. * modify it under the terms of the GNU General Public License as
    2 O. O- N9 K# M5 }+ x
  17. * published by the Free Software Foundation version 2.
    , p0 B, ?3 ^2 e
  18. *
    / Q3 M8 n6 f5 W( L5 \: b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 o% Q8 ^9 D5 Z( o! f
  20. * kind, whether express or implied; without even the implied warranty* H; Y- ?- Q6 d3 y) @+ T8 Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . N/ t3 r. z8 n& z! }) F9 F5 b
  22. * GNU General Public License for more details.
    6 k% q2 J, @& |" _. W6 v9 _! R
  23. */# i, }4 R4 A9 A: j; P0 s$ ^

  24. 9 J. [1 |5 _- W8 r% y% W2 h
  25. #include <linux/module.h>2 e/ \2 S  o: Q7 `6 v
  26. #include <linux/init.h>! V6 F8 Z- I; v5 |$ q! p- J2 F
  27. #include <linux/errno.h>
    6 o+ T+ s( G4 ^8 R# ]& N
  28. #include <linux/types.h>$ s$ Z+ l" n$ `3 S( B  {
  29. #include <linux/interrupt.h>
    ( {) K, W7 N! ~: q* P$ b; O' p4 N
  30. #include <asm/io.h>
    7 O: b. _9 M) A3 v
  31. #include <linux/moduleparam.h>
    5 r; O) D, z9 s# ?3 e3 L7 i* ~( J! m
  32. #include <linux/sysctl.h>" O$ H1 c4 t( `
  33. #include <linux/mm.h>) n. w& \1 ^- |+ I5 u8 k3 ]
  34. #include <linux/dma-mapping.h>; f+ j/ s/ k, g

  35. 1 S% ?, S* m- \  P5 c8 J* s
  36. #include <mach/memory.h>/ j5 o4 H8 `! R" c- G( a
  37. #include <mach/hardware.h>/ [, w1 G* D) z
  38. #include <mach/irqs.h>( }8 Q- m0 `" K1 D& ^7 a: U  ?+ ^) _
  39. #include <asm/hardware/edma.h>4 ]5 ~0 Y8 I# L) G1 H
  40. , v- S- j$ T5 x- u1 v7 ]
  41. #undef EDMA3_DEBUG9 V/ ~4 B) a) w$ [* N
  42. /*#define EDMA3_DEBUG*/
    , S3 r7 ]7 ]# x/ T9 Y& }* f
  43. , \' U7 k0 S, x6 z
  44. #ifdef EDMA3_DEBUG
    , y5 o4 ^. v8 G5 S% ]: }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 t! T0 |4 J( ]+ T) `# ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 u& I% W0 x* Z9 k5 s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); d; L. ?  O; D( o) [
  48. #else8 q8 Z. j, _- d3 H0 Q$ J7 V
  49. #define DMA_PRINTK( x... )1 @: p  a# A9 Z, h7 H
  50. #define DMA_FN_IN
    & V, j. s4 L3 A# K
  51. #define DMA_FN_OUT5 ]1 B% G% ]+ _& i
  52. #endif
    4 I# \$ h; X- c5 C
  53. 9 F* f6 u( }  ^9 O$ r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * b! a& s8 C1 A: K7 c! U3 J* W; W
  55. #define STATIC_SHIFT                3
    ( c$ S# t# N1 l) d- i
  56. #define TCINTEN_SHIFT               203 [$ v0 O2 f* w( B7 y6 W
  57. #define ITCINTEN_SHIFT              218 m) p* A/ |6 Z+ w, e3 ~9 v6 x" w: l
  58. #define TCCHEN_SHIFT                22
    0 w  S) {& m3 `
  59. #define ITCCHEN_SHIFT               23) t8 V/ g) A% \
  60. 5 T1 ]* f% J& D4 P
  61. static volatile int irqraised1 = 0;, R3 V3 {1 X9 \+ }) r
  62. static volatile int irqraised2 = 0;
    1 o- J+ W6 K3 p/ V
  63. ; H1 C" D% E7 `  A( E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% J' `) s; }6 P- I  u6 M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; K* g1 o8 E4 @. S- K: e% U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' ]0 j, |; M* ~

  67. . ]. K0 _5 T' r. r6 `0 v& z) d
  68. dma_addr_t dmaphyssrc1 = 0;( D- G; n1 s8 _7 U
  69. dma_addr_t dmaphyssrc2 = 0;
    6 w% `8 t9 H; f, V1 _2 p% h
  70. dma_addr_t dmaphysdest1 = 0;
    + y( ?5 r+ O6 n3 U7 q
  71. dma_addr_t dmaphysdest2 = 0;7 v4 ~- o7 A( g, ^7 P- j$ b

  72. 5 |/ A/ A. c" }
  73. char *dmabufsrc1 = NULL;+ s* S' e& t: @
  74. char *dmabufsrc2 = NULL;
    ! ^/ _  J; T# w  e5 V- `
  75. char *dmabufdest1 = NULL;
    * \" K- K! R1 J) {2 h
  76. char *dmabufdest2 = NULL;
    - [$ `/ j# q) b- I* I, I

  77. 5 T% E0 W' }" n/ ?0 I& t0 g; V
  78. static int acnt = 512;
    2 v0 d* G: F/ J% c; q1 d+ Z: W- j
  79. static int bcnt = 8;
    ' k  h. |; o% C  P5 J
  80. static int ccnt = 8;
    0 u4 \% }) S2 V  I3 m8 T) o4 S
  81. 8 D) G+ l/ T5 c7 x5 I
  82. module_param(acnt, int, S_IRUGO);* K5 s. N; f% |- S
  83. module_param(bcnt, int, S_IRUGO);2 D- _, k, ^$ B; {. l( a
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! k. J; \: W9 W5 b0 Y

  ~7 x! w( P7 j9 ^! b, K9 m      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: d" ?3 n; @$ Q. sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 \* ~6 Y; w* Y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: z2 u' a* z4 z2 g# c: R! U9 J: j
1 {$ a$ k/ H- W( u+ Y# L( ]* J0 A2 l0 V: [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-6 05:34 , Processed in 0.041445 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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