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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * [  K( ]1 a8 _7 E# S+ c7 V# v
  1. [code]EDMA sample test application
    % N, ^8 k/ i; i* }, p
  2. /*
    ; a% P. x* n6 U% F0 H
  3. * edma_test.c- v. B/ {1 C0 i) o8 A* a2 Q
  4. *, V1 q# v; J4 z2 [
  5. * brief  EDMA3 Test Application
    : q6 Q( p) h* v2 l
  6. *" l1 c) e0 y/ e- j
  7. *   This file contains EDMA3 Test code.9 f* U8 Z) t( q: z1 p/ ]. \
  8. *. r% T+ K( z! d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) Q1 D9 C1 n7 F8 \% y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  [5 P7 ?$ v& a0 f0 E6 [; ^
  11. *         TO CHANGE.
    ; ~: ~5 Z) s1 {+ r% K
  12. *& L( W8 k" [. f  Z$ _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 ^: i0 [- c! ]3 I* S
  14. *
    , Q8 R" Z+ p/ Y- M) i
  15. * This program is free software; you can redistribute it and/or
    ; T5 Y& ~3 `2 Y
  16. * modify it under the terms of the GNU General Public License as6 y( {+ F, u) M7 |+ c- H
  17. * published by the Free Software Foundation version 2./ P4 R, v4 E8 ]7 h) p
  18. *+ ?. j  }- i7 ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  Z* t. g, C+ A- w0 S
  20. * kind, whether express or implied; without even the implied warranty
    ; f/ h/ I% p- v! k. ?/ K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ }- z6 z! E$ m, O) B5 q4 x0 e
  22. * GNU General Public License for more details.
    4 [, q" l7 U+ F* H
  23. */' K4 u3 o9 K" i& B
  24. % v) ?3 {  x0 c& u$ Y; C, K( x% u
  25. #include <linux/module.h>
    : `: I1 a9 C$ F" M
  26. #include <linux/init.h>+ N& j- G! ^" H/ ?
  27. #include <linux/errno.h>& {7 V$ Y( J% }7 z( a- m3 A
  28. #include <linux/types.h>+ q: b" b, X% Q+ X- x
  29. #include <linux/interrupt.h>: [# o5 |9 H6 u4 q3 u- W/ [) h
  30. #include <asm/io.h>3 u4 |! n3 I* @& G# k1 q
  31. #include <linux/moduleparam.h>
    2 @  ~! a0 l& b- k
  32. #include <linux/sysctl.h>
    8 R9 u$ j! a% a7 f, g
  33. #include <linux/mm.h>" i) A+ G+ S% E9 {7 K0 U
  34. #include <linux/dma-mapping.h>
    - M- h! f$ _/ Y6 ~7 B) c. ]

  35. 3 S7 {1 F( k/ b
  36. #include <mach/memory.h>
    ( @/ _* A" ^5 Q- `7 d
  37. #include <mach/hardware.h>
    ! i1 e7 c+ C% Y5 e8 I# \) a7 \
  38. #include <mach/irqs.h>; ?- F. J5 z, K* U7 o  H$ W
  39. #include <asm/hardware/edma.h>) ^* g# f. U  F7 P- z% r

  40. , M9 D" d1 b! M8 a4 z
  41. #undef EDMA3_DEBUG
    ' y. [7 N& R! w! R3 [
  42. /*#define EDMA3_DEBUG*/
    9 g7 Y9 j& |8 X  H2 k/ H

  43. 2 V! `  r% c3 [& P- d
  44. #ifdef EDMA3_DEBUG
    4 O' G% `, \( H" X, [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). k& D6 t# w5 _7 x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); [  S  y4 u% S* |2 i9 q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; E8 E9 P! j, k1 ^) q  F
  48. #else1 l+ U3 [- x5 k
  49. #define DMA_PRINTK( x... )
    2 [7 j9 n' `7 R5 J
  50. #define DMA_FN_IN( f: |, s* }' m) ~  x
  51. #define DMA_FN_OUT
    + ?3 ^; A' X  e% }& Z& P
  52. #endif
      n) Q* ~. [; }' d! d
  53. ( A* e1 p% z- J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ t$ I' r% Q, R; {6 j* v
  55. #define STATIC_SHIFT                3; A: b0 Y8 W7 S0 q# d+ I! T$ f3 n
  56. #define TCINTEN_SHIFT               20
    5 O7 K* l5 c7 o! x- j( z( e
  57. #define ITCINTEN_SHIFT              21! C' |3 K; X1 l; e8 x
  58. #define TCCHEN_SHIFT                22
    " `/ V# v/ F) I$ i/ }
  59. #define ITCCHEN_SHIFT               237 a6 m" L/ m: h+ s5 R0 b

  60. 8 t$ l. i8 `  D3 m  H8 O
  61. static volatile int irqraised1 = 0;+ T2 {, _( E, `
  62. static volatile int irqraised2 = 0;
    " P4 e1 e7 |6 ]4 n

  63. $ @6 ]" C3 \8 ]- ?( k7 A# m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- H- t3 M' n) ~4 |" H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / j& |# j1 P- X& N  |. p' x9 I0 ?6 J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 `! y4 a2 F. f! U  o

  67. 0 l4 {  z- B) ?4 Q1 U1 t  O# M: G. H
  68. dma_addr_t dmaphyssrc1 = 0;
    6 f) b+ U  j- K9 E' c9 |
  69. dma_addr_t dmaphyssrc2 = 0;/ v  I; r% o+ P9 d3 M' q4 j
  70. dma_addr_t dmaphysdest1 = 0;
    . J+ t9 f0 j4 m+ b
  71. dma_addr_t dmaphysdest2 = 0;! y7 @9 R6 w* g+ F" Y

  72. 7 I; V$ u) q+ r( |4 `
  73. char *dmabufsrc1 = NULL;
    $ Q  M" y& x5 n+ {% p" Z: p
  74. char *dmabufsrc2 = NULL;
    % [5 }% w2 c0 s1 N+ L: {7 a' \
  75. char *dmabufdest1 = NULL;
    . X3 o3 T! O: ]5 \# W5 a
  76. char *dmabufdest2 = NULL;$ y9 j- ~# y- F" c, T
  77. ; I2 f" Y" k1 f
  78. static int acnt = 512;
    4 w# t0 n  a0 e. w- |
  79. static int bcnt = 8;
    ' @3 c6 M; s  t) [7 d) k, T" W) t
  80. static int ccnt = 8;
    ' |  {, S3 C: V- c7 ^0 X5 `/ Q
  81. * L" }  u2 k) }" e4 {- [. p8 q7 m
  82. module_param(acnt, int, S_IRUGO);0 D" d0 K* S8 p" ]5 r
  83. module_param(bcnt, int, S_IRUGO);
    - L' O0 S: {3 p' u; r! a2 Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ ~& F6 g' _' Y5 ?# ^2 u7 H+ V3 a( i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 N4 q, b( ]& g& karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" P0 i6 f: Q! u/ r; w% d' \; J6 u     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" }) u0 R/ [. K' d  I1 W& a3 p0 e

3 m/ ]) \0 J3 W, t. f9 {
( Q3 x' w+ U" |7 p& A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-24 20:12 , Processed in 0.039633 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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