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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . L2 ]% \! |2 ]6 M* E
  1. [code]EDMA sample test application1 j9 l) @9 B5 C. i; K3 n: k
  2. /*
    1 [+ x" k) o/ W+ t  F
  3. * edma_test.c$ _' b8 h! F2 w- T% _& ]! h" L
  4. *$ b0 E7 z% ^( B
  5. * brief  EDMA3 Test Application* k# M$ n% Y9 ]0 t1 C6 n
  6. *
    ' D* R' i8 G. s  ]. V# E
  7. *   This file contains EDMA3 Test code./ ^3 r6 F# D* q2 Q
  8. *
    ( G  Y/ {  @5 X' l% C2 P5 b4 K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: J# I8 [4 \, u( t2 `! }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 c9 o/ [% a* T5 s5 i. Q  v
  11. *         TO CHANGE.- ?* A! C# d5 w
  12. *
    : r2 J" p, d# |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      V/ Y) U* }- |1 @
  14. *! L( q0 D: a* }+ M# N8 [
  15. * This program is free software; you can redistribute it and/or
    4 Z8 Y+ ^4 M1 L
  16. * modify it under the terms of the GNU General Public License as
    * O. y+ ]6 {, P' I3 g% K
  17. * published by the Free Software Foundation version 2.
    2 Q! r  a$ ^5 P& V; V" J+ I+ w) Z
  18. *5 |' S7 f) {( J3 j2 K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . E  c2 F7 w3 m1 F) g! N
  20. * kind, whether express or implied; without even the implied warranty, N3 |8 J& W: K0 {  D0 I7 k* f3 v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : s4 M: F6 v% U' M# y# B, u5 A
  22. * GNU General Public License for more details.
    4 s0 x% ?! ~% J2 _, w9 V7 H
  23. */. w6 b) l/ r2 ?# S# E

  24. 9 z: W# `& J3 R; P6 H  C; T9 c# @
  25. #include <linux/module.h>6 |( T7 c  ~3 i- M* _
  26. #include <linux/init.h>+ ~5 R: P5 l: Z) o& g
  27. #include <linux/errno.h>& L8 b- t* E  W9 A7 n8 j
  28. #include <linux/types.h>
    ; c3 o. B1 @5 j, i2 P. q, A; _
  29. #include <linux/interrupt.h>) w" O  F- _8 |4 G. P  v; e# j6 n
  30. #include <asm/io.h>
    2 a8 o/ t( z) {
  31. #include <linux/moduleparam.h>
    ( K6 P/ L+ `( L; F' ^+ i; J! I
  32. #include <linux/sysctl.h>
    # a1 t1 K. J, D( P2 a/ w9 l2 ]6 i
  33. #include <linux/mm.h>
    . u" u. F: j9 ?- s
  34. #include <linux/dma-mapping.h>
    ) x8 r+ |3 U; z0 {! k

  35. 7 i6 a; z6 i* b" V1 X0 ?
  36. #include <mach/memory.h>
    ' I3 f6 Y' \- h+ u
  37. #include <mach/hardware.h>
    5 ^5 e" ?) C8 q1 P9 ?- C8 ^  s
  38. #include <mach/irqs.h>
    . X5 w5 p. B( k- ?4 T2 w& k
  39. #include <asm/hardware/edma.h>0 m* ]4 `7 }7 u6 k
  40. ( T% Q2 v+ w  G. I( Q3 w: v) ~9 M
  41. #undef EDMA3_DEBUG
    7 A! e" e! ?! w$ c6 ]
  42. /*#define EDMA3_DEBUG*/
    6 J4 D* F% X9 Q3 v

  43. + V$ ]/ x6 H! S7 Q& b# s; W4 G! i5 l
  44. #ifdef EDMA3_DEBUG- }- Z6 ~$ @- M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 K& v% M  b) C3 n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / N- p) w8 J, ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + ]- Y0 ^2 Z* n- S* S0 s; w
  48. #else/ E' U/ v1 V" }7 U/ n: Q8 A& Q
  49. #define DMA_PRINTK( x... )
    5 q. i2 F( ?) U
  50. #define DMA_FN_IN1 l$ z9 h5 Z, K
  51. #define DMA_FN_OUT
    6 n/ T* g. Q% n5 p! ~" Q
  52. #endif. u9 W% K8 l  K' }$ W
  53. ) M* `- M. D8 \) \" z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); M: c0 a% Q& _% s4 K' i- u: C+ b
  55. #define STATIC_SHIFT                3) Y: g4 }, \, n
  56. #define TCINTEN_SHIFT               20
    + A0 O0 s0 N5 I+ x, g
  57. #define ITCINTEN_SHIFT              215 q0 Y2 I* U* I6 v
  58. #define TCCHEN_SHIFT                22
    6 n1 {6 Y; L4 g' W7 I
  59. #define ITCCHEN_SHIFT               23
    ) ~/ J! v* I- T0 h

  60. + S' N' u  P- k6 w$ Z; I
  61. static volatile int irqraised1 = 0;
    2 i0 R  D+ p2 q4 O7 l1 N
  62. static volatile int irqraised2 = 0;$ c6 s+ Z( [* R: P" H+ \5 h$ P
  63. 3 G# \* ]6 i$ {+ H; G& E1 ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 e/ K0 [+ U: M# b; V' {7 k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( Y- F) |: {  z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. G. p$ T( d+ R

  67. 2 Q- O3 _. \7 d9 E
  68. dma_addr_t dmaphyssrc1 = 0;' n( J$ S, o: m# d. V9 W5 @$ d# P* ]
  69. dma_addr_t dmaphyssrc2 = 0;: L" V/ P" g! w% }0 q
  70. dma_addr_t dmaphysdest1 = 0;
    0 L  [+ o7 g( c% A, w( j
  71. dma_addr_t dmaphysdest2 = 0;& p& N5 L" m; Q# K) J
  72. # F' h8 h0 g; b
  73. char *dmabufsrc1 = NULL;, [* ]) n) p& [8 J
  74. char *dmabufsrc2 = NULL;. e/ r# B( w' g) d/ H" r; b
  75. char *dmabufdest1 = NULL;- k9 m7 M% e! b& ?/ N
  76. char *dmabufdest2 = NULL;
    1 ~& L- }* _& S' l4 @! v+ y3 t/ A
  77. $ H# R5 ]7 j# _6 z) e5 `
  78. static int acnt = 512;4 I" J- k$ m( [- t4 e( ]
  79. static int bcnt = 8;! p  b$ n8 [1 i' O
  80. static int ccnt = 8;$ Z* c( [* J' u: o
  81. # _5 n. _' b6 c& k9 ]( j' ?7 ~
  82. module_param(acnt, int, S_IRUGO);
    6 D2 o  L4 u* m( j$ a
  83. module_param(bcnt, int, S_IRUGO);" r9 Q! b" q: L6 R* X- I' x+ ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% u& j% K# `' ~: t, Y0 W& t( P

& x9 a- ]; o# t3 ^* K      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% J9 \9 j# I) X3 A+ w( n8 ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 r& ~4 e5 ?+ A5 s# i/ h     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 {/ W0 G4 a; u
; W- {: z, b. C8 p0 z8 z: o( ~
- j* ^+ @3 E) p) {) e9 |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 05:44 , Processed in 0.039496 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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