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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: |7 @8 {8 q, l2 Z+ Y4 t
  1. [code]EDMA sample test application
    8 p3 ]" M/ m8 z3 Q8 B3 v6 b" L
  2. /*+ U: s! U  S0 p+ c4 l5 H3 H
  3. * edma_test.c/ Z- `2 Y" L: Y: j5 l% p% K) V6 Y$ {
  4. *
    " j% H& m5 B; C5 W" {
  5. * brief  EDMA3 Test Application
    * x0 N+ [1 M5 D2 ^0 ^
  6. *. ?2 J* M: `& A* O5 \  H
  7. *   This file contains EDMA3 Test code.. s; q/ s) }/ V! B
  8. *
    " Z8 ]( B9 q, g" X1 Y0 r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * R* \0 Q# G1 ^. U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& U$ Z, y- \. s' X9 q$ Z9 J6 G0 G
  11. *         TO CHANGE.& m  W, {0 W, E. P& R0 A( a: q: D, W
  12. *& s9 @8 Y, y" h: r; F6 I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  E7 [- \+ X- ^6 D
  14. *' f7 t4 s) Y, n  x; @% g7 Y' ^8 J
  15. * This program is free software; you can redistribute it and/or1 l+ }* T& J( e4 V/ U
  16. * modify it under the terms of the GNU General Public License as
    7 ^. ]5 D/ M5 J0 l$ N
  17. * published by the Free Software Foundation version 2.- L) h9 X. w/ M
  18. *+ A3 \* n) r3 y% i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) B& q- [7 d1 R5 ~
  20. * kind, whether express or implied; without even the implied warranty; w% x; G' }9 l2 A+ B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 `) s, Z) t! x0 a, P
  22. * GNU General Public License for more details.+ I( V( m1 S9 {( e, C& v
  23. */
    - F8 D; C# `# E2 `% I
  24. " z, `: O$ E( j  ]) I
  25. #include <linux/module.h>5 j! t1 e& L* z( |
  26. #include <linux/init.h>
    ; o6 K: v' _7 E# e1 F1 J
  27. #include <linux/errno.h>
    + p# Z* d9 |- M
  28. #include <linux/types.h>
    & z7 B# f3 r, a5 Y; V
  29. #include <linux/interrupt.h>8 f2 X  L& x& `8 N$ t
  30. #include <asm/io.h>5 e% c6 k* Z! |6 h, S
  31. #include <linux/moduleparam.h>
    " F& I& W+ ~2 Q9 B. ?
  32. #include <linux/sysctl.h>5 C  [/ ?/ i8 t1 j  U
  33. #include <linux/mm.h>
    " L# \9 c$ t7 r/ `. s
  34. #include <linux/dma-mapping.h>
    ) E) m& ?$ W5 M

  35. ! k  `8 A( n/ d6 S+ g
  36. #include <mach/memory.h>" K! o/ v/ ~7 {7 T! t" y0 p- U
  37. #include <mach/hardware.h>
    : ]# R' b1 Y: R" b+ ?' F
  38. #include <mach/irqs.h>
    * q+ H, {' o2 x7 K! V* B, s! B" k5 M
  39. #include <asm/hardware/edma.h>6 T" b! c/ a  Z! |% a2 f

  40. ) h6 S' h8 m7 x- C- U
  41. #undef EDMA3_DEBUG
    ! A' s% s  r1 K1 D0 _
  42. /*#define EDMA3_DEBUG*/3 C. ]/ D! t# u& k8 p; n$ j
  43. 6 g; T# D- \9 w- w, }
  44. #ifdef EDMA3_DEBUG5 O1 L9 e) o9 X8 E  c- C7 M8 O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) D& O' M' W# ^, Z( _- x2 ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , v- p0 x7 ~/ E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& c& t; [/ D& w+ m: P7 g! Q6 s
  48. #else* F) N1 E$ A, G, V
  49. #define DMA_PRINTK( x... )
    6 r2 _& {2 g1 ^  D7 r0 _* f! C
  50. #define DMA_FN_IN' `+ ~. `5 _2 `# n7 G$ g3 K! t8 d# N
  51. #define DMA_FN_OUT. F+ \. W* T, ?7 z
  52. #endif  k* `/ M4 Q. s3 o7 t

  53. 2 Q5 X$ E7 [+ O7 }( u. U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 ^% ^+ @1 g7 j  N0 L
  55. #define STATIC_SHIFT                3% D* b$ T; U/ ~
  56. #define TCINTEN_SHIFT               20) ?! W- q! Q& ^* I* ~/ t" X
  57. #define ITCINTEN_SHIFT              21/ Q5 ]2 _. L5 u7 Z& W4 {5 ]1 v
  58. #define TCCHEN_SHIFT                22
    9 A, t# `# d0 n: g
  59. #define ITCCHEN_SHIFT               23
    , c: O8 w8 N8 D! s! r; S+ e. F
  60. $ R6 r5 t4 ^) ?
  61. static volatile int irqraised1 = 0;
    , g$ S- s% h  z5 L8 [
  62. static volatile int irqraised2 = 0;; T8 i# |: f1 j3 {

  63. - G) Z% \- y2 w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ M5 g/ ~2 f/ `7 ~, w* s+ n# b9 J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 T. `+ ^6 z+ x3 a. n$ B! l1 h! l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' B. R' G& T5 v& T9 R( `
  67. 9 A: D  E4 w4 B: t
  68. dma_addr_t dmaphyssrc1 = 0;* g9 R7 c- ^2 \- S5 N4 L
  69. dma_addr_t dmaphyssrc2 = 0;
    9 k! q8 d6 G$ l7 t# M
  70. dma_addr_t dmaphysdest1 = 0;- a$ w, i9 A/ m5 v) `8 l
  71. dma_addr_t dmaphysdest2 = 0;! f  L1 h" @. L5 H. C* j4 P

  72. : V& d- H" C4 O. y! q$ N7 u
  73. char *dmabufsrc1 = NULL;
    ' O) Y8 q6 q& H. {$ u
  74. char *dmabufsrc2 = NULL;& X; e2 d/ c3 A8 w1 ]3 H
  75. char *dmabufdest1 = NULL;% L  j  i; n, _2 s* _+ ?6 T6 g
  76. char *dmabufdest2 = NULL;
    . ?  ?5 h* a9 o( r1 T0 G6 L& y2 y: {
  77. : U. W; r$ H5 @9 ^' j
  78. static int acnt = 512;
    , `$ d" D$ y9 v
  79. static int bcnt = 8;+ i: F+ S9 H* t3 A. x+ {
  80. static int ccnt = 8;% K* ~1 B6 a" [
  81. ; I# {) D0 b9 D9 z) f/ N& h
  82. module_param(acnt, int, S_IRUGO);
    - e" q  R9 [# s1 S# `$ Z- |0 q
  83. module_param(bcnt, int, S_IRUGO);
    & z( G3 F1 r( Y# |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- S2 D2 D* i' C! A
  ?8 t# X6 J& w3 g# r2 m5 z1 i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 j4 N; d* O. v6 h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ D' |% G1 Z% ?6 O* s& ~5 q! I     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) r! m2 r, J5 g* ?) G6 L  E, Q" y, n& _" Z
* |+ j; j5 l7 b  A( M$ @3 S; c! \5 y2 P) f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-3 15:49 , Processed in 0.046089 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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