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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' w1 O% R8 h% ]! y/ v' I$ B  ^
  1. [code]EDMA sample test application
    6 h* @( o0 c. g' Q: M
  2. /*4 c7 ?2 d6 b7 y$ T* W
  3. * edma_test.c
    ! k1 J9 k% r2 `
  4. *- x8 g8 f3 Z1 Z" [: m: E
  5. * brief  EDMA3 Test Application
    / |1 {, N* ]- k" ~/ v
  6. *
    2 v* b1 \" f3 U5 y! E
  7. *   This file contains EDMA3 Test code." D9 w6 |" p8 d7 L- U/ p( ^
  8. *
    5 d6 u/ r0 _  j+ E( R$ J6 j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & w) x) i1 z2 c- o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ C4 \7 G5 x- A1 H* k8 y, n
  11. *         TO CHANGE.
    ( v$ M" K4 P/ h2 {: m8 t2 Z
  12. *! i( U0 Y4 ~$ k; w8 t: [! A; r- q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; ^. ?3 s% W9 [" K: z# X
  14. *0 k- Y7 s- M! D2 B4 P
  15. * This program is free software; you can redistribute it and/or
    6 B6 U5 q+ V6 X% V, L1 l2 U
  16. * modify it under the terms of the GNU General Public License as) Q5 a8 m; V' f4 S* _! s' c" A
  17. * published by the Free Software Foundation version 2.
    6 u9 |$ x/ @* \; Y% a+ \. m
  18. *
    " L- c6 I: @) @6 r9 \0 S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' \" M- C2 Q, i' b, R* p$ e
  20. * kind, whether express or implied; without even the implied warranty( ^  R4 T* q3 w- U$ R1 M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      C$ f# e" {% C# X, k; I) {
  22. * GNU General Public License for more details.
    * @0 F: R' d! g# q
  23. */
    4 ]3 m6 A- g, {" k& x  W

  24. 7 a- M/ a, N5 R2 U6 O3 b' e% h& `, }
  25. #include <linux/module.h>. I! v$ p8 q2 M& L1 H8 J; }# U
  26. #include <linux/init.h>
    + I4 ]4 {  |: L5 I5 O9 Y( c% S
  27. #include <linux/errno.h>: n  M: T) Z# ^4 |! j1 \
  28. #include <linux/types.h>
    + j; A' W2 n/ [% D
  29. #include <linux/interrupt.h>
    % f7 y2 N# B/ X& I! O# {  a
  30. #include <asm/io.h>+ S# u( H+ x. s& m( G7 B
  31. #include <linux/moduleparam.h>$ G( [! [: o: ]
  32. #include <linux/sysctl.h>2 Y7 O; c5 h! @3 r+ P
  33. #include <linux/mm.h>9 b5 l7 n* |* f+ j  h, }: s% `3 v
  34. #include <linux/dma-mapping.h>+ c. F+ I- N' p8 V/ X5 c, k

  35. % F' b' Z. z- }; X7 q$ L
  36. #include <mach/memory.h>0 i' K7 v. j) c* }' {
  37. #include <mach/hardware.h>; P$ e( j- r: h  X, R4 h
  38. #include <mach/irqs.h>
    / \$ _; d" S& d5 I. J
  39. #include <asm/hardware/edma.h>
    " ~  x) b$ C- ?$ p
  40. , ^9 D" {8 A1 r# T; E
  41. #undef EDMA3_DEBUG* ?3 h, z/ ]' C* S: Z8 P- m  V3 t
  42. /*#define EDMA3_DEBUG*/) F2 m% b% m; s4 C2 {* U" W2 w

  43. 9 t7 a( z# ]" r2 H. ~
  44. #ifdef EDMA3_DEBUG
    2 x, r1 ^5 t8 |( q3 b4 T; J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! p4 y, ^( o/ n. ~& [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 I5 n9 _( r* t) M! ?+ w3 b' u' X8 E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) m3 d0 ]6 w( B4 J8 X. C( P
  48. #else
    7 ?! n: B4 ~  U( D
  49. #define DMA_PRINTK( x... )/ Q0 H. J' i% ^0 g
  50. #define DMA_FN_IN
    2 c6 y9 n0 J% G
  51. #define DMA_FN_OUT* c& y- {+ o, d  V) M7 ]
  52. #endif8 e, k, R# }% E
  53.   W; k/ ~% j9 a! n# {2 r) J3 z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ y$ v) A8 v- [5 C" l
  55. #define STATIC_SHIFT                3
    - @4 L5 G, @4 Q( |8 ]  ]/ b
  56. #define TCINTEN_SHIFT               20
    : }) y% J0 J0 o( c- _3 v* E! s6 s
  57. #define ITCINTEN_SHIFT              216 D( h1 g( K! N7 o8 D2 j2 m  m" Q
  58. #define TCCHEN_SHIFT                22
    9 ^4 m1 [  ~1 r6 w, W5 I  o; ?0 @
  59. #define ITCCHEN_SHIFT               23
    . ]1 w0 i9 Q' d5 G( g& `

  60. - r; k- y- |+ u+ U) W4 J
  61. static volatile int irqraised1 = 0;7 B$ g! u2 X. j' G
  62. static volatile int irqraised2 = 0;& M1 P3 i( q# p) r$ V( p
  63. 1 E; ~4 h' x6 L+ l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 F( Z7 m" x+ n& ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  w" [, c) ?9 W7 g: v, _# C0 Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. X* ~1 N/ Z2 {9 y
  67. % l! z& g' i1 o' A! Z4 x! H' d3 X
  68. dma_addr_t dmaphyssrc1 = 0;
    ' e: u) ^, b3 o
  69. dma_addr_t dmaphyssrc2 = 0;# M2 p  ?! r' I$ S) T
  70. dma_addr_t dmaphysdest1 = 0;$ r' O& m3 D8 j) Q- O
  71. dma_addr_t dmaphysdest2 = 0;
    $ s7 }7 y7 U+ r! w; E2 l
  72. " g. Z* h. m0 g* d3 I3 F- Z, D
  73. char *dmabufsrc1 = NULL;. T6 m1 P6 `4 b
  74. char *dmabufsrc2 = NULL;( W( D2 i+ j' O7 C1 {
  75. char *dmabufdest1 = NULL;
    ; o7 b- \! L3 Q, u3 N- K
  76. char *dmabufdest2 = NULL;+ t; O" d8 C2 d- f( t
  77. % H! r3 q  t% M6 I' {: I
  78. static int acnt = 512;
    1 G- r# v6 G: M9 O) J( P0 ]' J. O
  79. static int bcnt = 8;
    7 E" h7 A" n7 K! R+ n
  80. static int ccnt = 8;- W/ v, i. _, \9 J
  81. * c# a& |- \: S1 B! B! V2 y
  82. module_param(acnt, int, S_IRUGO);' u& V0 ^! U- }' i
  83. module_param(bcnt, int, S_IRUGO);
    : Z- j! O. M6 z. R8 z3 M) m
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! n3 m! w$ J+ z7 |7 C

) O8 W# K! s' E- g8 x& \5 ~      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" j, C( |0 L3 E# W! 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 r& t; e4 T9 C; V2 f: m     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% L% K- N& B+ |- p0 t0 o4 v% O" X% A2 Q) |# U, z$ t5 B
2 I  \9 ^/ t0 `0 G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 14:37 , Processed in 0.047541 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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