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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; n- w0 }- T+ u! o! f5 X: w. [
  1. [code]EDMA sample test application
    7 L* x  y- _" x6 t) l' f8 Y) a
  2. /*7 b# t7 ?5 h* N( S; n
  3. * edma_test.c0 b7 D( V% z: k# l' L( C& r  n
  4. *' O6 I, ~% e# H: A8 t* ^; k
  5. * brief  EDMA3 Test Application
    # \# Q4 ]1 W! }' l: ~
  6. *" ]- [8 y  U5 ^" I9 N
  7. *   This file contains EDMA3 Test code.0 O3 o& \+ V" \2 S7 E
  8. *! k, N6 a# }$ D2 C( y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " l, B$ L5 F% V  D* ?. f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* z1 k7 U3 r3 X: V
  11. *         TO CHANGE.% X6 d" \- s3 S  ]& d
  12. *0 a% q! X2 x6 K7 N3 [% ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 [/ q8 |+ A9 H) R+ Y" _
  14. *
    & W" X7 K& B0 I4 c
  15. * This program is free software; you can redistribute it and/or/ E  g. I* `3 \; L5 E0 L& Z
  16. * modify it under the terms of the GNU General Public License as- T( y0 x$ z3 Q; b. d
  17. * published by the Free Software Foundation version 2.
    ; \* {8 U% P+ ]
  18. *7 e4 u8 b* v7 u$ m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ K. R6 q1 `% e; a7 W
  20. * kind, whether express or implied; without even the implied warranty
    - g6 j4 R4 |# z( s# ]6 x+ T! x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % s$ U& N( B( D# O! f, Y
  22. * GNU General Public License for more details.& m! c& ^# w9 V" k2 g
  23. */
    * A9 t8 f5 G. `) i) P+ e, }
  24. 0 c' T/ C9 F) O& G2 A8 s- K
  25. #include <linux/module.h>
    ) f; j0 W8 v1 B; A$ K: o
  26. #include <linux/init.h>
    2 q7 }7 P% Z* o, z/ Q
  27. #include <linux/errno.h>/ p) d& {0 c  g# I1 h- @2 ^& u
  28. #include <linux/types.h>+ O: ]" `/ s" X6 v* d9 g* K& [
  29. #include <linux/interrupt.h>  M( r9 T8 f* r6 _+ e. H. t
  30. #include <asm/io.h>3 _  y( b+ B2 U
  31. #include <linux/moduleparam.h>. U6 [* l1 L; s1 H3 H* w  }
  32. #include <linux/sysctl.h>
    9 i9 _% {+ y# L( B! `
  33. #include <linux/mm.h>
    4 W8 }0 c: `1 S0 E3 D7 H
  34. #include <linux/dma-mapping.h>* [, d* V; S, t! [" n7 g) O

  35. 5 Q9 i# q0 n( v( ^6 e, Z
  36. #include <mach/memory.h>5 j; q. F0 s; b8 a6 s* r
  37. #include <mach/hardware.h>3 g4 _- c4 R" ^  T1 u
  38. #include <mach/irqs.h>; L3 R+ c7 d7 R" h  m3 w
  39. #include <asm/hardware/edma.h>
    ; X3 G# ?3 ]: w/ k/ J

  40. $ A3 g. G* ~/ |- n3 N
  41. #undef EDMA3_DEBUG
    $ f. |. _) O* d' Y/ @
  42. /*#define EDMA3_DEBUG*/
    ) r& W5 l! t$ k( |, d: N

  43. : ]; j$ j) q, N
  44. #ifdef EDMA3_DEBUG/ q3 n* B2 x, K, c5 l8 S- `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 T* N7 w0 Q- a+ C, b  s, l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; w3 ?7 ~) W/ {9 X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; n0 E0 Y; K7 a$ m
  48. #else
    + Q$ }5 `% f+ |+ D/ M% P& j) k
  49. #define DMA_PRINTK( x... )
    2 A; k* h& r2 m2 [$ K! ^
  50. #define DMA_FN_IN" r5 K- a( Y' e; N7 Q) s
  51. #define DMA_FN_OUT. |& v/ g8 _/ Z  ]: q) |1 q6 X9 }, O' ?
  52. #endif
    7 n# ?# `% E( S$ ]% d
  53. 1 q. ?& j. }# j- z+ N) d0 n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! d8 z7 b1 S; B3 U
  55. #define STATIC_SHIFT                3
    3 k" T5 o( `+ T0 V/ V
  56. #define TCINTEN_SHIFT               20! I' t* A) t1 d+ s( @7 ?4 [9 h
  57. #define ITCINTEN_SHIFT              21
    ) d8 ^# C: c  H; W+ `
  58. #define TCCHEN_SHIFT                225 [( V" V% _$ w0 b7 o9 y
  59. #define ITCCHEN_SHIFT               23% z6 g* u1 c# x# o7 K$ q7 [
  60. ( I% U9 |( Q1 L& n# T7 ~5 ^
  61. static volatile int irqraised1 = 0;
    - P6 Q8 K1 f9 |
  62. static volatile int irqraised2 = 0;
    % V: `" _8 c. u  ]$ |

  63. ! L3 e# b+ W6 A8 O8 L8 ^+ h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  ^* I8 W  p8 Z5 I. }5 U9 ]6 Z7 ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 `, Z6 ~- w0 C( B2 q- [% ?0 y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . e  T5 b1 ?/ K$ {6 M. J1 ?' V
  67. / E" r& t1 w5 j( P+ ?( q1 u
  68. dma_addr_t dmaphyssrc1 = 0;
    / J2 {+ Z' [  j
  69. dma_addr_t dmaphyssrc2 = 0;' H( Z  j9 Y& [/ [* ?6 ^3 E3 U
  70. dma_addr_t dmaphysdest1 = 0;
    ) N6 f9 F2 i, ^% n% [
  71. dma_addr_t dmaphysdest2 = 0;
    ( @; o( u+ N" a$ I+ h
  72. 2 {; Q" i7 J. r% _) J
  73. char *dmabufsrc1 = NULL;7 \5 D1 G3 Y5 z
  74. char *dmabufsrc2 = NULL;  f2 s$ e9 {6 R
  75. char *dmabufdest1 = NULL;
    1 m" n) ~2 f3 \) H/ u8 L
  76. char *dmabufdest2 = NULL;
    % Q+ g; u! D1 o- @6 t' p
  77. + ^. B& B' b# G8 o! u: U- O
  78. static int acnt = 512;
    6 t7 ?7 Z% J! K* y5 q
  79. static int bcnt = 8;' ]; }' t) D! q- T. G
  80. static int ccnt = 8;# {8 i7 W0 y$ P' {0 h& t
  81. ! R% `* d* ~0 o% A
  82. module_param(acnt, int, S_IRUGO);
    9 _) u" ?" }$ u, m, |
  83. module_param(bcnt, int, S_IRUGO);" n; h& R* d; C  e+ X( z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, |% _* R% n8 p7 S
9 M7 h5 S! o; p! N) f      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 e' f) y- ]( z( tarm-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 ~5 m: u% }5 e     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; N: \' i4 \$ C' a1 s* P9 W
6 s; A' |1 ^; e0 S
; |2 z! o  o" Q/ G& g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-20 16:46 , Processed in 0.040785 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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