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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 k! F' r0 x8 t( [% Z4 D2 T; h0 ]0 m
  1. [code]EDMA sample test application8 y/ B& S! g3 r1 h' W3 A
  2. /*
    3 }9 c" k# b9 O+ x! R+ B) [
  3. * edma_test.c/ {: D+ N1 |: e. m" a
  4. *
    5 K- B1 j% M$ k
  5. * brief  EDMA3 Test Application
    ; R4 |: k# p# v6 ~. S6 T4 V
  6. *" j1 U8 x" r- S3 g
  7. *   This file contains EDMA3 Test code.
    - l2 D" M7 s/ @* T$ Q
  8. *
    / o6 C9 ?. r* s- B3 i$ v) U' |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- p3 S/ O6 f+ a8 z; R% a6 Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 F) f! b# g! i( m3 Y  z
  11. *         TO CHANGE.
    9 t0 _1 e2 H) G' f+ ~. t% R5 J: t
  12. *6 a& _$ B7 t. _( I  `0 J& j4 D" o7 y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' [$ [3 J$ Y2 R2 B
  14. *1 ?9 s4 R+ O9 [' w
  15. * This program is free software; you can redistribute it and/or
    . _0 ?* r" q' C0 M* L6 k# l+ p
  16. * modify it under the terms of the GNU General Public License as+ I) k1 }* M6 H" F
  17. * published by the Free Software Foundation version 2.+ n1 J! b* u0 T  ?1 a
  18. *
      \/ [6 m7 U: a! T: n" B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 b/ N+ K% \% b* L; V5 W
  20. * kind, whether express or implied; without even the implied warranty
    + f+ ]% {: q' b8 y5 H/ _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( ]. ~0 M5 L% w' v2 C+ D9 U
  22. * GNU General Public License for more details.8 v2 R! ^+ c4 b6 o7 Q" W
  23. */! c# o0 c1 f; B

  24. : t  w1 _/ H" T0 p
  25. #include <linux/module.h>+ Z4 Y+ s1 v2 u5 B0 E+ R4 C
  26. #include <linux/init.h>% @5 q7 H4 I( r8 K$ s1 r
  27. #include <linux/errno.h>/ p. D& w3 U* a% B, I, R, T2 D# o
  28. #include <linux/types.h>1 h9 Z3 S/ ^5 q0 G7 j& F7 y
  29. #include <linux/interrupt.h>: r( ?' E! l6 a8 W6 g! J! d
  30. #include <asm/io.h>
    " k. G6 ], u- g, W4 Y! z0 X2 T5 h
  31. #include <linux/moduleparam.h>
    # q/ q: L* @, E3 X
  32. #include <linux/sysctl.h>
    0 Q7 v% Y! K9 u4 h; W4 M
  33. #include <linux/mm.h>
    0 C5 h' A% {9 {' W
  34. #include <linux/dma-mapping.h>7 H  A4 K% N1 e0 H- t# M- B
  35. 3 r8 Z" V7 W5 Z4 F3 h. ]* q: `- H- W
  36. #include <mach/memory.h>
    7 O  v9 K" ^1 \: m1 F* N5 [3 z
  37. #include <mach/hardware.h>
    0 B1 b& i1 |% u! Q2 C: Q# H3 v
  38. #include <mach/irqs.h>
    % y; e7 W  N0 a
  39. #include <asm/hardware/edma.h>
    % z+ ^! R$ |2 O# {. x

  40. " C' d+ s  x* M% B
  41. #undef EDMA3_DEBUG
    " C6 e/ f4 I% |. E
  42. /*#define EDMA3_DEBUG*/% X1 A$ v8 _- l. V# R% A

  43. " [8 _. ]& C" O3 f& x: @5 k
  44. #ifdef EDMA3_DEBUG7 c, S: ]5 M3 y: q8 ^/ |  A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - I8 T( K6 Q% A; r* f: ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( V; J6 r7 |- k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 Q- I! ]" a2 |/ [8 ]9 y: W/ n* d
  48. #else
    1 _9 w# [2 V1 h0 m  N1 v/ u; d
  49. #define DMA_PRINTK( x... )
    . x- y% R0 n/ y* |$ P4 P
  50. #define DMA_FN_IN
    . p( b3 a1 U0 x, T1 Z# y% j) [
  51. #define DMA_FN_OUT
    & `: N* B; S; j
  52. #endif
    * U2 K+ w& v( U1 n% C/ c) u
  53.   k* Y: h  E8 J& O* N2 Y: \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 s' K, Y: E2 F# G, V" L
  55. #define STATIC_SHIFT                3* ]( d8 j- T0 i' {6 s5 Z5 D+ c% X
  56. #define TCINTEN_SHIFT               20& Y3 j- M1 Q, c& E' X8 z! j
  57. #define ITCINTEN_SHIFT              21
    9 u' x& d0 ^3 b/ }7 }# r* T; @+ @
  58. #define TCCHEN_SHIFT                224 p& s, U0 N5 G! |) Q
  59. #define ITCCHEN_SHIFT               23- J0 H- w8 @2 @3 c+ k; ^

  60. $ |9 @2 G9 c  v
  61. static volatile int irqraised1 = 0;9 V, I+ z( @' `
  62. static volatile int irqraised2 = 0;
    ! Z% Y$ [. g+ \5 i2 B. z
  63. ! {, |8 [8 Y/ z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      u2 D% \) m. @/ T' V; {: L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 ~' F, b/ e) Z7 ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 {3 l2 T8 [3 P4 J
  67. ' e, o& _$ V; J* H) S* z
  68. dma_addr_t dmaphyssrc1 = 0;9 M& Z+ z" P- e3 O* C* C
  69. dma_addr_t dmaphyssrc2 = 0;1 x6 [' Q* `6 w6 W+ q
  70. dma_addr_t dmaphysdest1 = 0;: H! {+ F$ A# j  _7 i) E1 p& w
  71. dma_addr_t dmaphysdest2 = 0;+ w- C+ f' f7 m5 M8 b
  72. - {4 W% z3 B8 Q4 s: o# Z) @
  73. char *dmabufsrc1 = NULL;
    7 G9 @/ p4 j: G: ?0 L$ b
  74. char *dmabufsrc2 = NULL;+ |% z" i) b1 ?
  75. char *dmabufdest1 = NULL;' N# x7 c; l$ i& U
  76. char *dmabufdest2 = NULL;7 J6 I, `; w0 }. I0 I
  77. 9 c, i0 v; t( t* E+ C/ ?9 X
  78. static int acnt = 512;
    % {, W9 h1 c% \8 \. s, G
  79. static int bcnt = 8;
    . P5 K- I& j4 ^' g- v1 n0 T
  80. static int ccnt = 8;
    + S9 L4 T' O, H$ \5 M. _% `# m/ U
  81. . A: |, W% C2 [9 `$ m. i6 M  R
  82. module_param(acnt, int, S_IRUGO);
    - |( d" ?9 |1 v! I% F
  83. module_param(bcnt, int, S_IRUGO);
    ) ?8 E) K. G$ A: @6 i! s2 R4 I" U6 Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! n3 J# N8 l: n3 R3 K

; Z: M5 W* n; }0 @* j      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' J8 k/ w- M, j, z% Y- k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* u- z) J& t, x     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 k/ Y8 A7 b, P$ z' m0 B' N
! c: `# k* m$ R: i! l
* _- p6 l7 U9 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-11 10:04 , Processed in 0.039439 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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