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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; w0 K* t; t$ E7 T% e
  1. [code]EDMA sample test application+ ]2 d1 ~( h) Z, u& [+ }
  2. /*
    0 |, u) `0 ^! p7 @
  3. * edma_test.c: C  e) D# d! Q7 b6 V
  4. *
    7 c/ \0 x) T$ v1 b
  5. * brief  EDMA3 Test Application$ a2 m1 l5 m) M1 B( n
  6. *
    ; X: {8 l0 ^- D! l8 Y6 @* M
  7. *   This file contains EDMA3 Test code.
    ( [  ~+ h# b' `
  8. *
    - I1 U5 \! j$ d+ Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 ~- S( _  o# C9 g' \/ l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 ]9 }5 U) @! B3 e; @- x, \& X
  11. *         TO CHANGE.& u0 [2 {6 V# B' L3 \
  12. *
    ' u0 ]1 E- a4 X/ K7 M# r2 ^; Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 U; c. E% n) t+ P
  14. *
    1 ], }$ g* ~$ H3 T: v
  15. * This program is free software; you can redistribute it and/or( k* b) f' z2 k$ I" ~
  16. * modify it under the terms of the GNU General Public License as
    ( s6 d" ?. }! m6 R
  17. * published by the Free Software Foundation version 2.
    4 B  _# m+ v- E8 p* V7 d, ~* u- L
  18. *
    " y' C" \4 A/ B7 T9 E4 g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * p( C2 L5 K; ?$ F
  20. * kind, whether express or implied; without even the implied warranty
    9 j1 T: _/ S2 r/ M5 m9 o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. P% ]6 i! q1 P  g
  22. * GNU General Public License for more details.3 e6 r8 t# z9 o& P# L
  23. */. m; ~4 e% _6 @' H
  24. 1 t5 y9 {) r0 ?
  25. #include <linux/module.h>
      V0 O% p/ }& Y- T3 {
  26. #include <linux/init.h>
    3 j# m5 A+ L) T7 s
  27. #include <linux/errno.h>
    6 @7 v* T7 p( y& w" |  D% y, B
  28. #include <linux/types.h>. i' n0 C5 _" |
  29. #include <linux/interrupt.h>
    ( p# ~+ B* M$ r( U! D
  30. #include <asm/io.h>' p( g" N/ {) ^$ L' b
  31. #include <linux/moduleparam.h>* i6 w  U7 [' }* L( _
  32. #include <linux/sysctl.h>
      I: {3 W+ r5 N
  33. #include <linux/mm.h>2 y% F, u( n3 C
  34. #include <linux/dma-mapping.h>
    , I' A) S- i% V
  35. . Z+ F8 [5 C) z& D; R& r" }" G
  36. #include <mach/memory.h>
    , ]9 R* c6 D2 G; |3 P; m
  37. #include <mach/hardware.h>
    % |% W8 S4 x4 l: T2 K
  38. #include <mach/irqs.h>
    ; G0 x# Z( @* ~/ y9 H: M
  39. #include <asm/hardware/edma.h>) U  ]: D$ `/ v

  40. . u) d) y1 U& l) H
  41. #undef EDMA3_DEBUG5 q% C5 v' t' Z9 |
  42. /*#define EDMA3_DEBUG*/$ b% u- a% C% P3 O7 F( ^/ ^2 B4 m1 N
  43. ; W5 i& n+ Q7 X5 K
  44. #ifdef EDMA3_DEBUG
    4 r; y" K9 r  p& S9 F% r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* F; o* q+ e( i$ ~* J' o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! i, S7 ^* V; b7 E, r. r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! J% `0 Q  |5 C) O
  48. #else3 e/ |1 y( @* m! {2 y; H1 a. N- |
  49. #define DMA_PRINTK( x... )5 U/ u0 j- M: Y7 D4 C1 d
  50. #define DMA_FN_IN8 P  X. B9 q) O" W; x
  51. #define DMA_FN_OUT
    $ ~, B4 ?( B, `7 h$ G
  52. #endif
      ~2 D: m; r$ P: d' k% N5 k

  53. - G4 U* r5 n: q& Z7 A, ?* _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ |9 d  N7 M, V: e* O! q9 ^
  55. #define STATIC_SHIFT                32 E0 w0 i* P9 D- n) [/ L; r0 p
  56. #define TCINTEN_SHIFT               20
    : T% w" V/ c2 e" X
  57. #define ITCINTEN_SHIFT              21: A5 |* u  A+ m* N0 F
  58. #define TCCHEN_SHIFT                22, l) j$ b, m# u( Z4 ~
  59. #define ITCCHEN_SHIFT               23+ A& D% \( V. @' ]8 r/ Z5 [2 W

  60.   Q; H8 [: P% M7 ?" r& j* K
  61. static volatile int irqraised1 = 0;4 g. F: F+ P6 X% `% B
  62. static volatile int irqraised2 = 0;
    6 m6 Z* j% h' Q  e$ Q8 D

  63. - p+ ]1 R6 L( q" G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - {; |3 H- |. e& V# Q. B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, E" _7 n2 q# N! M# i/ M5 y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 |; N3 g, Z! v1 f6 r8 @6 E
  67. / G/ r+ r9 u& N3 ^3 F
  68. dma_addr_t dmaphyssrc1 = 0;
    ; b! n; ?' U: p9 n) O/ i
  69. dma_addr_t dmaphyssrc2 = 0;$ O0 F3 s  n7 c0 Y0 Z
  70. dma_addr_t dmaphysdest1 = 0;. y7 E( T2 q' u. U% c6 b
  71. dma_addr_t dmaphysdest2 = 0;) k7 W+ K4 \7 }0 J, H) t
  72. " l  M* M$ B+ v; M0 c7 ~9 U2 u
  73. char *dmabufsrc1 = NULL;# H" g9 M% g5 d& ^1 N
  74. char *dmabufsrc2 = NULL;
      _% R: N, `! g8 f6 H
  75. char *dmabufdest1 = NULL;1 ^( H6 q/ T/ j- H1 p" s1 L
  76. char *dmabufdest2 = NULL;; h/ q( G, D2 N- j6 f
  77. ) j8 p/ K. \& p( ?  \
  78. static int acnt = 512;
    ( U4 ]3 c# x$ D! g5 A7 A& h
  79. static int bcnt = 8;
    7 U/ k1 H3 m+ j, j* O
  80. static int ccnt = 8;
    % V) s. h6 @: z

  81.   m0 g" k/ F& z% W
  82. module_param(acnt, int, S_IRUGO);8 {1 z0 X) O, {
  83. module_param(bcnt, int, S_IRUGO);+ L: E1 F! V9 |3 }3 O
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* j+ B, M. X, e' v1 g7 E* X' ]
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 B$ }8 q9 K, t- J/ v: G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- I+ o% I5 `  i& N
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ }! M# o/ o; P0 e) i

; ?* n1 o- p* A
% {  o$ o6 K; G8 J9 Q% A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-11 13:38 , Processed in 0.040483 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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