OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - |; ]1 w* b+ R9 I0 L& b! R
  1. [code]EDMA sample test application6 V8 I, D2 L! F! w4 R1 c
  2. /*9 k6 D7 `" o. p- G' B2 H1 }; b2 @
  3. * edma_test.c5 v2 g! n5 d  |% H6 F
  4. *3 i: f4 N& a' G
  5. * brief  EDMA3 Test Application- ~1 S- Z' D" x& O  K
  6. *) l! |: \3 ~. K3 l
  7. *   This file contains EDMA3 Test code.; D- S" h. t; ]  M* w! S
  8. *
    9 k8 ~9 [/ M) Q/ Q" x, e, s/ A+ y5 \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . p# u8 h# {8 x/ o! t# m! a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; Z6 l+ I7 ], z2 I
  11. *         TO CHANGE.
    5 I+ u  D" a  |7 }( m
  12. *
    + ]1 g2 G: G/ B$ R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . `9 ?$ z, N7 D0 L6 K
  14. *
    . s9 c. B7 A/ L/ Z9 U9 v
  15. * This program is free software; you can redistribute it and/or
    8 t" t' X4 n7 H
  16. * modify it under the terms of the GNU General Public License as- V( \: f/ C! K& F  ~" T! S
  17. * published by the Free Software Foundation version 2.
    + l! C' }/ v2 k/ w$ _
  18. *
    $ C4 o) E3 W$ \( _# s, B1 p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 f/ T& t9 O/ g( V$ y
  20. * kind, whether express or implied; without even the implied warranty7 ?2 m+ p+ m0 L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 {- @, u% U2 M5 ~, `# w) X
  22. * GNU General Public License for more details.
    $ v* r( t% Y  U8 ]
  23. */- _' Q+ u5 g* a0 e5 S5 \/ D% W- ]" c
  24. 4 U$ a7 }! c# n0 P3 @
  25. #include <linux/module.h>$ ^3 L0 H( {/ v$ O( _. r6 J: ^
  26. #include <linux/init.h>
    & P+ p- |9 h1 \( A# W5 o/ L
  27. #include <linux/errno.h>
    3 u' |/ O/ W& m; p0 A
  28. #include <linux/types.h>3 N" m7 Y( q4 q# i- l( K3 P& {
  29. #include <linux/interrupt.h>
    ' Q2 b  L7 i4 B4 X& F8 }0 i
  30. #include <asm/io.h>
    . P' _2 B# ~9 f, L
  31. #include <linux/moduleparam.h>6 b& m5 X, g+ n) \4 T8 |* f
  32. #include <linux/sysctl.h>; W6 Z! H2 q$ @: \6 U3 V/ S
  33. #include <linux/mm.h>  U0 ^: v; [  Z) z; K3 H& b
  34. #include <linux/dma-mapping.h>
    + x# g1 A% j9 r# r8 H, R
  35. & \$ S9 h4 A% k; H
  36. #include <mach/memory.h>; D* m+ `* L( @& N2 s
  37. #include <mach/hardware.h>
    $ ^+ l7 F& c% J# V, a4 T
  38. #include <mach/irqs.h>
    . g" a9 b5 U0 `; j/ }  w  B
  39. #include <asm/hardware/edma.h>, }& X. H! H6 [3 X
  40. $ a& _7 l' j5 I! N5 q8 g; R- p4 y
  41. #undef EDMA3_DEBUG/ [7 l# ?) U; a
  42. /*#define EDMA3_DEBUG*/
    4 f5 t7 u* D, _) E  W1 ~

  43.   l( ]1 \' p$ i* t9 \8 [
  44. #ifdef EDMA3_DEBUG
    0 ]3 ]( H8 s4 l  v) d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! Y3 B( N3 a/ x$ w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 g0 u% X9 K  Y$ _" M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # |( X$ ~1 \% `: q2 ~" ~
  48. #else
    8 f) |" G1 j$ i* S4 H( {6 M. Q
  49. #define DMA_PRINTK( x... ): |# ?; \1 }9 @/ c' {" K6 {
  50. #define DMA_FN_IN& f) l' ?: Y" P0 }3 @! x
  51. #define DMA_FN_OUT0 ?) v" e  J5 A
  52. #endif
    % E0 ~$ K- K% [+ _( \
  53. * K, G2 D# e, h+ E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). ?% v$ K- k, P$ M) u: s  [
  55. #define STATIC_SHIFT                38 N. C! z9 n9 S; D" A
  56. #define TCINTEN_SHIFT               20* T$ {9 V1 A8 G, N# r3 k# K
  57. #define ITCINTEN_SHIFT              21
    ! f: |5 H, Z( A2 @) y6 ~
  58. #define TCCHEN_SHIFT                22
    $ W1 B- O- c& R
  59. #define ITCCHEN_SHIFT               23# @- }# K0 k. f) c0 B8 Q
  60. 1 [( Q4 e- T( s" f8 ?
  61. static volatile int irqraised1 = 0;9 t3 _0 k, f! j& v
  62. static volatile int irqraised2 = 0;+ x0 o7 v7 s& f+ K, ~
  63. 2 L/ h8 M5 p; f4 z1 X. j* o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - s6 B# t# H7 _# G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ A  {& {$ c0 e$ a) {  X! [: y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% f. c* o; K6 j% Y* ?

  67. 2 M; s7 R- x7 c  _5 F
  68. dma_addr_t dmaphyssrc1 = 0;
      C: }: v1 Q; r. P- f
  69. dma_addr_t dmaphyssrc2 = 0;
    " D5 \0 j6 N3 G( P3 ?/ z6 L9 {
  70. dma_addr_t dmaphysdest1 = 0;
    7 Z2 v( \$ p7 ?, R
  71. dma_addr_t dmaphysdest2 = 0;; s& M: }# T2 \! |7 r+ x6 V

  72. + l# Y" |+ U$ z; t2 d
  73. char *dmabufsrc1 = NULL;# q! d3 a) y! ?' l7 [
  74. char *dmabufsrc2 = NULL;
    ! w% w5 \7 Z8 N% e1 x1 Z
  75. char *dmabufdest1 = NULL;
    4 j" `9 d5 `5 M0 y' @" O
  76. char *dmabufdest2 = NULL;$ E- i7 I* i( A9 n9 `' h- W

  77. ! j- g& x% r5 j9 u- d
  78. static int acnt = 512;
    9 e' l$ F: v' T, l  a
  79. static int bcnt = 8;7 k+ p" V2 k+ `) v  H% A
  80. static int ccnt = 8;' V5 c% h. I; O! l
  81. - P3 k/ S4 U; \2 Z+ B# f% _; y- \
  82. module_param(acnt, int, S_IRUGO);
    4 }) ~0 O* a6 A+ L1 W
  83. module_param(bcnt, int, S_IRUGO);
    6 F6 t0 ?# v) }: X7 o+ D% ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 K# T5 r& V, ]9 u  d3 @" `: Z
; A: L$ q+ p; i7 o: ~) I1 H( G      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% f' J* Y4 Z# L8 i6 u; k4 _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  ~' Z% |4 |7 z6 `+ y/ u     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ r8 v& ?$ Q9 ?& y2 c& }' [1 u+ u0 K, K- w* o" y5 B2 p
$ i2 A* P7 h, _8 n5 h. H1 M9 O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-7-19 06:59 , Processed in 0.037331 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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