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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 c9 S- m. ~' V  n8 n5 }" b
  1. [code]EDMA sample test application; d1 s  Z' `; Q+ y- d7 ~9 f( h
  2. /*
    ; m$ Q# R# [/ w% a7 e& @; E+ B
  3. * edma_test.c' }* R* c, X/ R2 a* o7 {
  4. *
    - j; l& |- b# Y9 H
  5. * brief  EDMA3 Test Application# e, n+ H% m+ {. m9 i
  6. *
    $ g" t+ @  r( w- ~- \/ u, K
  7. *   This file contains EDMA3 Test code.$ ^0 X+ l& O4 F) ~- d" O. M9 X
  8. *
    $ g0 V* d4 ^6 M# A" J  l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : a4 G- \$ j/ g1 |* N; ]5 C/ M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + E, y4 x. l, x7 Q
  11. *         TO CHANGE.
    . Z* g* R3 i3 Q' u8 n: k
  12. *
    4 Y0 O2 v) p- D* e& F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - ]- w9 K" g! Y4 u- w1 m
  14. *
    0 n# x4 e5 @1 Z; S
  15. * This program is free software; you can redistribute it and/or- Z( l( {* W; h8 v1 S7 F/ \* D) [
  16. * modify it under the terms of the GNU General Public License as
    / D' ~6 m8 o5 ^* j* k0 {( S1 A
  17. * published by the Free Software Foundation version 2.3 M. z: @% E7 j# }
  18. *
    2 P5 }0 Q( E6 S' E% e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) q% ~& z6 O% ]! T
  20. * kind, whether express or implied; without even the implied warranty$ I$ n* O, t1 s5 Y9 i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 c2 r1 l+ \% q1 X4 [6 ]
  22. * GNU General Public License for more details.% K* @1 `6 o) K5 C  }- T: W: `, K
  23. */
    , N8 U3 U) P( N8 `2 m5 ?5 s
  24. 0 [  k( B4 k. h2 V" R, g: e
  25. #include <linux/module.h>
    + ]( Q: s$ J' n" W6 u: W
  26. #include <linux/init.h>+ W) W8 y9 K" k# A3 k+ D+ B4 E1 {- ]
  27. #include <linux/errno.h>- `3 F# h  w* ?' S
  28. #include <linux/types.h>! ~, J4 [/ L2 R  t8 [7 G
  29. #include <linux/interrupt.h>
    ( Y- p3 P0 Z2 E+ U. V5 g
  30. #include <asm/io.h>
    % Y5 E; ^3 T! v3 \3 ]
  31. #include <linux/moduleparam.h>
    % J5 j' @( \0 l# S& [0 v
  32. #include <linux/sysctl.h>* P9 S3 f; Q! ^3 Q3 H% A
  33. #include <linux/mm.h>2 C& x- v' q# u' J' x% U, t% F% ?
  34. #include <linux/dma-mapping.h>- h, l6 Y9 d) G

  35. 9 B0 a" a/ r, B' {2 F8 Q8 v
  36. #include <mach/memory.h>0 f9 j' V/ o& P9 e; v
  37. #include <mach/hardware.h>6 k6 d7 `: K" N8 k8 D: V# m, ?
  38. #include <mach/irqs.h>) k& F) ]* P' s: g8 }% p
  39. #include <asm/hardware/edma.h>1 J2 `8 t* U" V1 u( v

  40. 0 Y/ c, {- e/ T; w6 F
  41. #undef EDMA3_DEBUG, z% C' P( o6 Q( Z3 I9 |$ `/ v
  42. /*#define EDMA3_DEBUG*/8 Y* X" I$ R8 l$ f

  43. # B3 Y- i+ W* `3 X) G* h
  44. #ifdef EDMA3_DEBUG' E4 o( w6 d# b% W  J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! m; J3 @- @8 \; Z9 t# t( f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " m3 c0 u) n$ k* t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / ^0 A5 \1 A' A' X: G+ O; R
  48. #else
    4 z0 M: E, A1 N9 S/ @
  49. #define DMA_PRINTK( x... )% \" @' q- v- d( k
  50. #define DMA_FN_IN
    $ F  c( e  K; Y7 V  m3 M$ j
  51. #define DMA_FN_OUT; ^# G$ @! K/ X8 h8 ^  F
  52. #endif
    $ k' L' h( i% r

  53. , C1 w) ~+ a# B2 o1 J! z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) h' k9 X: F0 ^: ^0 `, A$ Y, |
  55. #define STATIC_SHIFT                3
    + {6 o% {6 o" i' l% o* Q4 \! `: _
  56. #define TCINTEN_SHIFT               20
    2 X- c3 c& q" N8 _
  57. #define ITCINTEN_SHIFT              21& ~) l% Q. K7 l9 g
  58. #define TCCHEN_SHIFT                226 E+ A3 l% P4 Y; _  d
  59. #define ITCCHEN_SHIFT               23
    $ y& H$ I- L, R
  60. : l0 n" x+ {9 t  p  c
  61. static volatile int irqraised1 = 0;
    * D& |! f3 @/ {
  62. static volatile int irqraised2 = 0;
    + @+ E# v3 H. A7 @8 `+ P

  63. ) K( N/ S+ T  B8 I" N+ k) R$ _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& o- m2 I9 @4 B7 I* f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 ~: K9 w" K; J! h* K/ ^$ D& `2 U5 w' m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( O+ z) M) r9 z3 f3 D

  67. 6 g' V9 v& K) p/ u. e+ {: k7 M
  68. dma_addr_t dmaphyssrc1 = 0;3 Y7 M+ R" }- z6 `1 K- v
  69. dma_addr_t dmaphyssrc2 = 0;( Z3 M( o9 O2 \1 L
  70. dma_addr_t dmaphysdest1 = 0;6 c: y% [& o# v0 _# i6 R& o
  71. dma_addr_t dmaphysdest2 = 0;
    2 {5 z. D" ~' k: N) e) }  d4 ?

  72. / y" |9 I5 X. f- X) I
  73. char *dmabufsrc1 = NULL;9 a: U! m2 k4 j# x- \
  74. char *dmabufsrc2 = NULL;! q! v' M$ O0 W8 F- P3 j& t
  75. char *dmabufdest1 = NULL;2 q$ t1 H1 W2 @: d( z! r/ Q' c
  76. char *dmabufdest2 = NULL;
    ( F, g# y. A6 V7 x4 _, }1 ~
  77. ( E' I$ E) T: ]
  78. static int acnt = 512;
    - S, Y. }. z/ T+ R6 C1 U0 }
  79. static int bcnt = 8;
    6 T* e6 i* L2 b- O( r
  80. static int ccnt = 8;! g$ A$ [2 w. h+ d8 f7 X; |

  81. 9 E$ N: M& _. N) q8 D$ J4 K9 p
  82. module_param(acnt, int, S_IRUGO);: O6 i; k4 r# B% U0 i
  83. module_param(bcnt, int, S_IRUGO);
    $ t3 D) ~3 c. Y3 F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 t5 J: O' K' l, @( Y2 u! K

9 ]8 G+ g! W. M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ ^, l8 c; [: ?- s) M& Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) K% e1 K- Z$ i! s  `  k* N: z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 C1 a) y- }' t$ N
! g8 h7 Z  B( W9 v) i

/ F; j# ?% `4 K5 {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-12 17:00 , Processed in 0.038272 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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