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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  G* Z& {# Y  d  s/ B
  1. [code]EDMA sample test application, `4 K& @+ @" T) H0 V" U* a# Z
  2. /*% m; m( l6 K- U5 P% M
  3. * edma_test.c) J' C) ]8 f- I- Y+ y$ E% X  ]
  4. *
    . V( X8 B3 r" q; q. p3 C
  5. * brief  EDMA3 Test Application
    ; M' N* U( @! a. j9 S5 \: J5 A
  6. *7 t5 f6 \: G& I- P0 D6 M( `$ ?1 w6 o
  7. *   This file contains EDMA3 Test code.
    ( c6 n5 Z4 F) c" H4 x$ e
  8. *
    * o# X5 u7 ?( h7 A. Y" }+ h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' |2 w! M! d" I* W, w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 X; x) J* [9 n1 h, j( |4 v
  11. *         TO CHANGE.
    ; B# p+ p8 E7 q- z; Z5 e
  12. *, M9 d2 u2 Q6 ?. L- \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) N; x. _: O. e& T: O( b
  14. *: S- i; O% `8 c; a! f$ W
  15. * This program is free software; you can redistribute it and/or
    8 A5 Z/ K6 U6 H* I
  16. * modify it under the terms of the GNU General Public License as
    % `! g# E; Q6 n1 L0 `
  17. * published by the Free Software Foundation version 2.
      f' l4 Z$ T6 @( Z4 @) ~
  18. *
    " s! {/ X: |# V( `! B( N0 B6 G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 E  T$ g3 {8 r1 \$ d+ r" J
  20. * kind, whether express or implied; without even the implied warranty( R* [; c  m  S6 c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - L- M& a( \7 s
  22. * GNU General Public License for more details.
    - ]# I; G( k* @' D2 \  y
  23. */: u4 J/ b+ m, O7 \

  24. + }4 {3 |* @6 t+ x7 {
  25. #include <linux/module.h>
    * ~" H* m; X8 ~4 d+ [  l
  26. #include <linux/init.h>
    $ m% n4 P6 X9 k) w# d* k
  27. #include <linux/errno.h>" p, v! K6 p, g' y
  28. #include <linux/types.h># y5 q/ p, y! ~; M) ~
  29. #include <linux/interrupt.h>
    6 l) H8 J/ Q" g; K) V) x* r, i9 ?
  30. #include <asm/io.h>) r: {2 l' w% h# j$ f  V2 X
  31. #include <linux/moduleparam.h>
    ! J& L. H. ~2 O% S
  32. #include <linux/sysctl.h>2 K3 Q- O* u) R, q) R# ?3 u% ~
  33. #include <linux/mm.h>
    ; k! `" L3 c  k  f
  34. #include <linux/dma-mapping.h>. x- P: r) @0 ]& O
  35. ' i/ \& a  P) W% y" P9 F' T* r
  36. #include <mach/memory.h>
    6 X% V' A. _5 T$ g8 |' B7 W
  37. #include <mach/hardware.h>
    7 }& Y- A3 b1 k. r% D7 e; }
  38. #include <mach/irqs.h>
    . K/ T  J8 I+ m+ E4 D
  39. #include <asm/hardware/edma.h>
    9 v, \  c' m( j+ q% J

  40. . A1 l  K( R& t( j
  41. #undef EDMA3_DEBUG' j- j! l( G8 K( q2 W3 s' D
  42. /*#define EDMA3_DEBUG*/
    * v8 o+ J+ O# ?; R" p* \
  43. . H& d" V! [* ^+ j' S# h
  44. #ifdef EDMA3_DEBUG
    5 r" b% S& e) a& A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 R& k* _( w% t  B' \- }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % k5 b2 Z2 T( |) c" r4 K- K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 _: }& k/ i: ]( R6 V7 w: z
  48. #else
    8 E0 ]9 F9 W5 I4 [/ H8 r5 W
  49. #define DMA_PRINTK( x... )
    * N% G, s' {  M  B
  50. #define DMA_FN_IN
    - }& L" _1 ]9 y* l+ [8 A; C  O4 C
  51. #define DMA_FN_OUT
    1 |$ p7 }/ t, R
  52. #endif% v* D! x, b0 k% [' G: R

  53. + h" ?; E7 k0 b/ g1 D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # J( M8 e2 c0 l4 Y
  55. #define STATIC_SHIFT                3" g, ]: _" m3 {
  56. #define TCINTEN_SHIFT               202 n7 P! B8 k; {* ^' H
  57. #define ITCINTEN_SHIFT              21
    6 `, R- u9 l7 O1 j" u  v" @
  58. #define TCCHEN_SHIFT                22# N  M/ R3 ]! N5 J, S
  59. #define ITCCHEN_SHIFT               23; n" `8 L  G" U
  60. / N6 T' z5 C4 [' e
  61. static volatile int irqraised1 = 0;
    $ p5 c' E: v) b- k/ L5 r  }! @
  62. static volatile int irqraised2 = 0;
    & L1 x+ [2 @( `2 P9 P+ X$ ~4 R

  63. 2 H: T/ o; e/ g; o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! r! ]& W" Q) v) o! }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 @+ [" H) l' Z9 B4 s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: k! o" T2 g! [2 S6 v

  67. " g- L2 E# [8 I/ Q9 i
  68. dma_addr_t dmaphyssrc1 = 0;" S* g9 l$ M" @6 s3 E
  69. dma_addr_t dmaphyssrc2 = 0;
    ' k( Z* N& S; B& l, f
  70. dma_addr_t dmaphysdest1 = 0;
    ( M5 }9 y2 U2 X& G$ F
  71. dma_addr_t dmaphysdest2 = 0;/ B4 G% F* i; @) _, @' Y
  72. ) Y) i7 F! A; ]5 k- M$ O
  73. char *dmabufsrc1 = NULL;
    + z/ @0 p8 a- `" k- ~5 |% C( t/ R
  74. char *dmabufsrc2 = NULL;1 x4 ?: g+ J0 \: {, B" ], a! r
  75. char *dmabufdest1 = NULL;: U+ x& u3 P+ [0 U) W
  76. char *dmabufdest2 = NULL;
    % U( A- S, b/ W4 q: ~
  77. " G2 S* s7 U% P' U3 Q4 O1 p
  78. static int acnt = 512;
    , i0 |7 w) f+ z  _% v$ X
  79. static int bcnt = 8;5 _* e. x# p+ ?4 c4 J; d5 N
  80. static int ccnt = 8;
    4 G3 Y; ~8 [/ b% |& X, M

  81. ; c4 A3 A2 v) _: V6 B2 t
  82. module_param(acnt, int, S_IRUGO);1 q' R; _3 Z' U- e4 e' Z0 y
  83. module_param(bcnt, int, S_IRUGO);, w& N" g( X5 j+ J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 J. i$ l# g* A3 L( T
8 {! c  ?. g8 t6 ^4 C" C5 Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' r6 X+ x: k" _8 T9 W1 q7 {5 Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' V6 B4 I* z1 N     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 s) n+ ^6 n# p4 y/ K8 r
- F1 e/ I! {2 U- v' P) T- j% z2 x$ I# e% v! R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-19 23:12 , Processed in 0.038282 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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