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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 M& w1 L7 U! [/ S
  1. [code]EDMA sample test application# m- f% J/ ?1 a& B) O5 K0 u
  2. /*
    : ~* B6 v+ s' ]1 `) i3 B
  3. * edma_test.c
    $ E. |& q+ }) K  d" e) X' V4 `
  4. *# M  _# h6 s2 S% K* G
  5. * brief  EDMA3 Test Application: i  y* {1 r: a6 t4 }* v
  6. *$ k6 v& x* e/ U1 C, D) G" V
  7. *   This file contains EDMA3 Test code.3 ~. `* Y$ }* k
  8. *: E5 T* ~- Z" X; h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . b7 n  B3 @% T& X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: j4 V& }/ y4 a4 o1 ?& I
  11. *         TO CHANGE.
    6 P9 r6 x4 |% g4 v' q; Q
  12. *
    ' u) b2 A/ Z6 i3 F. @2 \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// t4 d; J1 \( U0 l
  14. *& {9 V- G# T1 R4 [3 r+ \0 h$ U0 V6 S
  15. * This program is free software; you can redistribute it and/or: j) L* n! T- n3 W6 J
  16. * modify it under the terms of the GNU General Public License as
    : ^/ |/ m+ Y4 e
  17. * published by the Free Software Foundation version 2.$ R) L9 `! e$ F/ o" M9 @6 ?
  18. *
    1 p8 B* a" }' z" v2 [2 u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! S7 \6 ^# Y# X$ a) [: L4 \# B+ ?  q
  20. * kind, whether express or implied; without even the implied warranty
    9 @) a5 B3 F7 V1 H2 v) B. s! B" z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : J# v3 l$ a% a: l6 ~2 l! C
  22. * GNU General Public License for more details.  H5 J6 U6 w1 B" w" J
  23. */. E# Z0 m$ t  ]# Y

  24. 7 G" K, [% ?1 `& {# U
  25. #include <linux/module.h>  ^( }) o3 W  Q
  26. #include <linux/init.h>
    6 x: z) R3 _. o4 j& k
  27. #include <linux/errno.h>
    1 l. \( @* B) f! Z: Y" J' Q
  28. #include <linux/types.h>
    ( c+ h4 }( c6 f' f7 |
  29. #include <linux/interrupt.h>
    2 Q( k+ ^& F  s( L
  30. #include <asm/io.h>
    ! b0 a, Y' l6 \3 k3 i+ p0 n
  31. #include <linux/moduleparam.h>
    9 |8 ]+ B* I) z" h6 K' n; F
  32. #include <linux/sysctl.h>, U0 e2 w' b5 N$ T" c
  33. #include <linux/mm.h>7 x7 k. ?) J9 {  ~
  34. #include <linux/dma-mapping.h>* V- @% }. |. E) R! |/ \) |- a

  35. 4 ^0 A% p' z' X: }' R9 a0 Q
  36. #include <mach/memory.h>
    - |3 \8 ]2 r+ B" \6 }7 T
  37. #include <mach/hardware.h>- y. V7 }! z1 t
  38. #include <mach/irqs.h>
    % g; |" t+ D: V+ T( e
  39. #include <asm/hardware/edma.h>( H5 f" \$ Q8 d& f  q
  40. $ r4 i0 V7 d4 t0 A9 V) u& P
  41. #undef EDMA3_DEBUG- W* f# ?' g7 V- h% q
  42. /*#define EDMA3_DEBUG*/- h2 d+ o# b# K  h+ ^
  43. $ @0 x4 k4 ?* x% {$ [. l
  44. #ifdef EDMA3_DEBUG! C% ]; G/ ^) m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 I# E& a7 g) X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# z" L- ^) {( ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), c% |3 v' j+ Y$ w# c
  48. #else9 U, i  w. L) e) O- ^( o- p
  49. #define DMA_PRINTK( x... )7 U# \9 V0 z/ \5 `9 T$ t
  50. #define DMA_FN_IN, {  q0 J8 R& h& X
  51. #define DMA_FN_OUT; F- q- a! W8 j& r% ?4 a( D& N  G
  52. #endif
    $ }' V, g9 v) o4 J! l

  53. , c$ t* a9 Q9 Y  B" {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 x5 x  \" N1 N# c! w  J
  55. #define STATIC_SHIFT                3, M8 m, G( S; y
  56. #define TCINTEN_SHIFT               20: d1 e$ [- E+ U2 h3 g
  57. #define ITCINTEN_SHIFT              21
    4 V# g* m( k% Q% o' x7 G1 s
  58. #define TCCHEN_SHIFT                22
    ! V1 z9 l% f7 {" S+ H( u
  59. #define ITCCHEN_SHIFT               23
    & }: `! @6 |- Z- L1 R
  60. / S6 H% |, D: c2 W4 o4 q: I5 j& z+ b
  61. static volatile int irqraised1 = 0;7 a. U9 W" s5 l1 C$ h+ h
  62. static volatile int irqraised2 = 0;
    $ M% d  o/ V1 N' X! Z2 q. `
  63. ! P7 V; N+ ]9 C/ ]+ g2 [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 T: C$ G& G) E$ a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , V) S! ~/ ?! o) A: ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- i9 a+ Q+ U) `/ B
  67. 9 n$ n, W: e  s/ o  w3 l8 O
  68. dma_addr_t dmaphyssrc1 = 0;! D: L( c! V, D
  69. dma_addr_t dmaphyssrc2 = 0;9 ~$ _5 w  D( M1 i
  70. dma_addr_t dmaphysdest1 = 0;5 `7 B# _# J* z  X9 a# O, U& b. i
  71. dma_addr_t dmaphysdest2 = 0;/ J  @( r$ K8 z+ \

  72. ( S2 F9 B' |2 p- [
  73. char *dmabufsrc1 = NULL;
    $ s0 H+ T  |+ |0 A
  74. char *dmabufsrc2 = NULL;
    ) k, E2 d. m' r3 P
  75. char *dmabufdest1 = NULL;
    ' o6 Z( N8 ?- S: \
  76. char *dmabufdest2 = NULL;4 }% `- G* i5 a' {( a, S% ]" n7 A

  77.   ]; u) s% p/ ~
  78. static int acnt = 512;
    ; I; F, p) {3 V( a
  79. static int bcnt = 8;* K- R: @; L0 O0 L* ^! }5 Z# \
  80. static int ccnt = 8;4 ]; y* }( c. \" i, k/ ?
  81. 2 D; O& O" N' {$ a1 k/ d
  82. module_param(acnt, int, S_IRUGO);
    2 |  Z% a2 {4 e0 T
  83. module_param(bcnt, int, S_IRUGO);8 c3 B  |2 T& {/ I; J  X- Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 q. n" a* i1 w# I' y

4 _4 K; E7 U$ V( `! l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% K. K/ I1 ~: y5 _, ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 H- F$ v1 _" D7 {1 @! K+ J9 b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  e( e' ^( o) ^9 d( [: F# J7 O( g

' p! y( D' l! ?. _  d, K1 ]& D: I* H/ i7 G' K. g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-20 18:56 , Processed in 0.039388 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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