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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % q: G/ U8 a+ }
  1. [code]EDMA sample test application0 i: ?7 C! x' o% o: r: V5 y* x
  2. /*
    4 [1 k" k) ?% N7 q6 e4 F0 w* f
  3. * edma_test.c
    / x* O! ]4 i8 e" O1 d& Y; Y7 |
  4. *6 L3 ]6 t, ?+ g$ L6 Q: X' C1 n
  5. * brief  EDMA3 Test Application$ @) ^  l2 B6 a' T% Q
  6. *
    # U  U) y5 }$ |9 I$ Z; ~
  7. *   This file contains EDMA3 Test code.5 d. N+ u' [8 H7 J( G, |& x
  8. *6 L9 i4 n. S2 ~- i$ o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, b# u* _% x1 B: G& K0 b5 `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ O2 z/ L5 g: x% A
  11. *         TO CHANGE.
    1 D3 \1 {2 |  n7 O% J3 c6 o4 P; X" j
  12. *; v# q- s# |) a" |$ m4 M+ F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 T. N) p3 |7 ~
  14. *$ Y& m* `' k3 [- u: `
  15. * This program is free software; you can redistribute it and/or
    & P/ R$ @1 ?+ L+ a; t; Y# u, l
  16. * modify it under the terms of the GNU General Public License as
    - U$ S; i4 l: b* r) q. w
  17. * published by the Free Software Foundation version 2.( |3 @8 L6 e7 {
  18. *
    7 |! q) T/ D5 C& R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( T0 N/ N! u2 L9 s* i: N0 H
  20. * kind, whether express or implied; without even the implied warranty
    4 A1 T- u! \. ^; F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  k  w" S8 Z+ M) C5 k
  22. * GNU General Public License for more details.
    . f7 \: A/ S& `! z# b7 @
  23. */
      C' z& W2 @! M

  24. ( t9 j1 X7 V. R; Z
  25. #include <linux/module.h>3 V: W, _  C6 J( ?$ ], ?3 G1 f& t
  26. #include <linux/init.h>
    . I4 Y* e% z7 Q
  27. #include <linux/errno.h>
    $ P% \  b  Z4 l; C8 `1 D/ s. L
  28. #include <linux/types.h>
    0 N9 n1 t8 s1 z# Z- P8 ?( h! ~* J
  29. #include <linux/interrupt.h>* v% G" T! p3 x) c1 H, b
  30. #include <asm/io.h>
    & U7 Z+ n  a  w3 F! |6 F
  31. #include <linux/moduleparam.h>
      v7 T. `2 F" B, D$ |
  32. #include <linux/sysctl.h>- a/ J8 C  J1 E' }1 x% A5 P/ U) m
  33. #include <linux/mm.h>
    # k3 ?7 B( Z. ^; @& X6 ?& r1 a
  34. #include <linux/dma-mapping.h>
    4 w- {3 [( }  n
  35. . Z2 a/ W" I( k* j
  36. #include <mach/memory.h>5 G2 |: S6 N; I( J
  37. #include <mach/hardware.h>
    8 \" `# o) n% i' Y) ^! v
  38. #include <mach/irqs.h>" I$ H7 I8 H& L, E* n9 ^
  39. #include <asm/hardware/edma.h>$ X* w0 n7 v0 x& V0 |6 K* }
  40. , S9 V* N6 ?( t! a. R' n2 y* x
  41. #undef EDMA3_DEBUG, d1 f1 b* U& I
  42. /*#define EDMA3_DEBUG*/  y4 b$ V& ?( t' |  U( u4 D

  43. 6 x& {* [+ Z0 f+ w, c
  44. #ifdef EDMA3_DEBUG
    $ H9 x, h' d5 y# a9 _" I3 p# J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 Z* E% p/ l9 P4 d" W3 @2 \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 U, W- v) ^4 C6 h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      u! J* i! J: P  I5 S* K; q
  48. #else8 j% X& @+ N9 \+ O1 H& ~& K) L
  49. #define DMA_PRINTK( x... )
    ( k% G& m2 r* F2 t
  50. #define DMA_FN_IN' Y+ ~0 D7 a5 b. Z2 ?8 y8 ^; u
  51. #define DMA_FN_OUT/ _& R* R$ s7 l4 y' j
  52. #endif
    6 }$ v! M" T2 Z% W! R: h
  53. * O* r$ t2 ^" \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" L, M4 T7 p9 Q7 B9 e* o
  55. #define STATIC_SHIFT                3
    ( {- g; O' y( g2 @/ g
  56. #define TCINTEN_SHIFT               201 Y" {3 n3 a9 L; m! ], R, ?6 ]4 k" J
  57. #define ITCINTEN_SHIFT              21
      Y1 G4 ^3 }. E0 I4 A; x, Q
  58. #define TCCHEN_SHIFT                22: P4 K$ [. w7 h# ~0 ~
  59. #define ITCCHEN_SHIFT               23
    + V- c* X. Q# e
  60. , q# U3 E3 B6 ~
  61. static volatile int irqraised1 = 0;
    ! i- Y; U0 ]4 G) a# Z* H- a
  62. static volatile int irqraised2 = 0;
    5 S/ r6 N4 R- w; X8 ]
  63. 8 G1 P3 j1 b7 D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; Y, V: f% I3 Q3 O, d0 I/ d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) r/ D- _0 y8 r' u2 Q+ e7 q# _8 o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; o( K. `, ~9 W; G% r' Q
  67. 6 B" h% P& g% m/ |8 f
  68. dma_addr_t dmaphyssrc1 = 0;2 N* {) m& K( B  l
  69. dma_addr_t dmaphyssrc2 = 0;
    1 ?) `5 }2 T2 P# y$ B! D1 ?  R$ Q
  70. dma_addr_t dmaphysdest1 = 0;3 G' e, n8 c, c
  71. dma_addr_t dmaphysdest2 = 0;
    ! j1 h; A% ^- G4 L8 e+ e
  72. % H# W/ Y' m1 g. \8 D: j! X
  73. char *dmabufsrc1 = NULL;
    7 }0 q) s3 L. e7 I
  74. char *dmabufsrc2 = NULL;$ c2 n8 k9 m  k6 N
  75. char *dmabufdest1 = NULL;2 o0 Z5 O5 ]% S  W
  76. char *dmabufdest2 = NULL;4 V- T1 A# X" d
  77. + K( K4 N4 Q6 m  ~% K& m
  78. static int acnt = 512;
    . K0 o- L& x, b' m, v, B3 A& ]
  79. static int bcnt = 8;1 y: K* n0 F# d4 q8 P7 H& |; _
  80. static int ccnt = 8;
    6 N* I1 }' B5 |( L

  81. ) r7 p; ]6 M4 u+ ~8 G
  82. module_param(acnt, int, S_IRUGO);5 l4 P# o, ]( K# {( x" w# D7 ^
  83. module_param(bcnt, int, S_IRUGO);% ?- l+ B5 ]; v+ }: g* t6 e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 E! x" N9 ~  Y# A% ~& v
3 q. d% x' X; }8 }) x- B5 f
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" {" i/ D$ j7 O: i" Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 _2 t9 g- X! A* x; j     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" ?8 l, y9 s/ [

; b" Y( A4 E* A3 [( V4 @' c& q+ ~+ M( v, W( D6 y4 b) Z8 T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-3 12:52 , Processed in 0.042068 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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