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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' U4 u; \  b' C6 R% n, |
  1. [code]EDMA sample test application
    0 s! L. L* w2 C9 U
  2. /*
    1 a6 j6 z  {% @, K" D& v
  3. * edma_test.c
    3 k' B0 b! M9 q: ^
  4. ** C5 a& y/ e, m% K  r9 E7 x# f
  5. * brief  EDMA3 Test Application
    : @/ W: |, J# E8 [. }" z
  6. *, w. P( G. l2 H. A
  7. *   This file contains EDMA3 Test code.) _' }  J0 r  ]# N7 V% [+ U
  8. *& g% {8 h7 K7 R0 H9 G( b5 p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 e7 ?0 H! }" g; V  a) G7 j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 [* K3 G( P! X+ b* `" @
  11. *         TO CHANGE.6 j. M7 p  X! q6 T- ^
  12. *
    ) O! k) G$ e9 F! m( x5 ^/ g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) G8 X# h- @/ m$ R
  14. *
    : q) t6 _. V& k$ D/ [+ w0 M* Q, v
  15. * This program is free software; you can redistribute it and/or
    ! _6 ^5 b1 C8 V) f' f2 g  k
  16. * modify it under the terms of the GNU General Public License as3 Z; s8 V/ C6 F3 T7 J" H" \
  17. * published by the Free Software Foundation version 2.
    & r" N3 ]9 G2 Z  a! P
  18. *
    1 A! T0 a/ r5 w8 j" ^, h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 Q" Q1 E* _- x! m% G. R) x  M
  20. * kind, whether express or implied; without even the implied warranty
    " H/ l8 n8 _# c: z% W% E, X) P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& `9 F6 Y' V4 ^+ {. W. _( F* g
  22. * GNU General Public License for more details.- {/ B( Y; a* w: h5 y
  23. */
    , b5 W9 z& l- d% l# n
  24. / m* z" v: R( X$ i' D2 T1 {7 y$ l! E" Q
  25. #include <linux/module.h>
    ; Z- z, E2 O. G! z* v+ m
  26. #include <linux/init.h>; T8 ~$ F9 ~8 f. ^3 e( ?3 B
  27. #include <linux/errno.h>( V. U9 F$ y/ D- e( Y  s0 c
  28. #include <linux/types.h>
    : a9 W) n' ?5 C& v2 j
  29. #include <linux/interrupt.h>8 o. n* b& b& {+ H& ?& P
  30. #include <asm/io.h>
    - h0 F) Q" D3 U: m. G* L: b
  31. #include <linux/moduleparam.h>1 X) u9 \7 d5 z; T
  32. #include <linux/sysctl.h>8 V0 j& q. P. g; R
  33. #include <linux/mm.h>8 q3 ~* g- ?% E; `7 a/ m
  34. #include <linux/dma-mapping.h>: y) K2 p, d" _/ A
  35. 2 Y. T( D2 `, A9 l0 A
  36. #include <mach/memory.h>% g0 v# w7 a# U& ]! B" `
  37. #include <mach/hardware.h>
    + c9 B. F9 u$ u4 x
  38. #include <mach/irqs.h>
    ; n( ^6 N9 v: R( v$ x8 B
  39. #include <asm/hardware/edma.h>  ]' A, C0 H3 c0 ]) q$ i6 g

  40. ' w- O" u- u4 [* B& t8 Y5 s$ E
  41. #undef EDMA3_DEBUG
    ' n$ X8 V8 X- C* o3 N9 X
  42. /*#define EDMA3_DEBUG*/
    ! S$ c& m# X* |* `* F  V
  43. 4 w* P7 S1 g% ?8 W+ m6 V) A+ d
  44. #ifdef EDMA3_DEBUG+ p9 H* H7 i# h8 m2 |4 P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; q; G8 Z3 u! X: Q# J- P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 {# _6 [) `8 o& ?9 p% R, q$ I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : [# v! A4 J" d3 |/ s
  48. #else
    3 T  \4 U7 O4 y8 g) d; C- Z
  49. #define DMA_PRINTK( x... )% d! E! ^+ f! l
  50. #define DMA_FN_IN
    + z- G; J: f% u- _( `# |
  51. #define DMA_FN_OUT
    - |- [" z) j0 h  k  j- g6 M0 l2 k
  52. #endif
    4 |4 n+ z4 m1 ~* ^  X: O! B  }1 U
  53. * z! u, ~# k5 n+ n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! \4 N$ d3 p7 c
  55. #define STATIC_SHIFT                3
    9 @' I/ m* d" l! a  o. p7 R
  56. #define TCINTEN_SHIFT               20% I- C+ {! T) U6 ^$ m7 ~- n
  57. #define ITCINTEN_SHIFT              21
      I4 E2 @2 S! X- a
  58. #define TCCHEN_SHIFT                22
    : R# b5 G% W6 _, b; s; X5 x2 ]7 e
  59. #define ITCCHEN_SHIFT               23
    4 d  U" f" T1 H0 j; r
  60. 3 u0 m: y% k5 `7 }7 X
  61. static volatile int irqraised1 = 0;) H5 o5 z: _  U: k& z! y
  62. static volatile int irqraised2 = 0;3 u' L, w" N8 n* }% }$ T
  63. ( Z  l6 v# {+ y, F1 s# @+ `, f  ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' n  R3 E9 x! N2 f$ |& C! u  m# K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* i5 C6 V, ~- h% s1 ^* w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( ?$ C1 S; |$ R1 u% r# F; L
  67. ' J" S, P0 D/ B/ L3 p; U6 l# T
  68. dma_addr_t dmaphyssrc1 = 0;
    1 }! U: I. K/ h. @! E% g
  69. dma_addr_t dmaphyssrc2 = 0;! @2 Z' b) d& O& |5 d
  70. dma_addr_t dmaphysdest1 = 0;
      }' Q/ g2 f' B2 p4 f7 [4 Q, P
  71. dma_addr_t dmaphysdest2 = 0;( ]1 L1 Z  o9 V7 j
  72. : P+ f/ z/ ?, ~* t' Y: L! ^2 I
  73. char *dmabufsrc1 = NULL;4 s8 ^; e- |5 T9 x
  74. char *dmabufsrc2 = NULL;% w) \  x) x' {$ _
  75. char *dmabufdest1 = NULL;
    0 C+ U. t5 t1 q7 G
  76. char *dmabufdest2 = NULL;
    , W& {  ^4 k( r' A1 V

  77. 9 @) n2 {6 X* W" |7 a  ^& C
  78. static int acnt = 512;
    . `  F  O' }  ~5 N1 J# g* C7 t
  79. static int bcnt = 8;; t% k5 ?5 z5 {2 C
  80. static int ccnt = 8;
      G6 ?# i: E* {: t

  81. * e, i% C( y8 O' {6 Y* Z$ Q. G
  82. module_param(acnt, int, S_IRUGO);
    . C; h& O7 c. o* ~0 Q* q0 h
  83. module_param(bcnt, int, S_IRUGO);/ t7 \+ D( m7 L9 K2 e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 U4 s7 e* h2 X8 j9 w5 A: y. g* q

. a4 s+ R% @) k$ I      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 M7 S% F+ X; oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ ]( N( Y2 n! I9 L7 y9 P, T* z; |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 |4 t( h# X6 V( B
+ `. S3 x, W4 d  x4 e4 _8 x, A
- H* M9 l2 L; j# @9 Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-11 11:28 , Processed in 0.041430 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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