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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , A6 v) \, a4 |$ ], C# p
  1. [code]EDMA sample test application0 G# i, d" G! ~/ r& D, p
  2. /*4 f2 y; b% P5 {: w
  3. * edma_test.c2 @4 M. k/ m, Y8 ^
  4. *5 p/ c; B, A" G% i8 x" E+ V1 S
  5. * brief  EDMA3 Test Application
    3 v$ O7 @3 }* G5 r+ U% O
  6. *. l- I9 {4 d) s- e
  7. *   This file contains EDMA3 Test code.
    : s* g: K: v* O/ _5 o/ v% L# r; }- G1 I! a
  8. *, P& r7 _2 l$ Z: d" X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - J; w, D3 U( H' j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; J/ a) B' q8 B) b
  11. *         TO CHANGE.
    , B$ S& M$ E( v' G  P
  12. *! m* d& R. i8 n5 e4 x3 H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' x, n9 T4 R' j/ F/ B
  14. *
    ) O9 k6 I" S8 E; ~' M7 I7 O; B1 ^
  15. * This program is free software; you can redistribute it and/or. \: G" ^3 P0 V  H  q
  16. * modify it under the terms of the GNU General Public License as
    4 B8 O* w+ q& v+ I
  17. * published by the Free Software Foundation version 2.
    . k7 c4 u$ k9 C0 b5 G
  18. *3 d4 J) s  L0 N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : G8 }. T- W2 v; }: J6 C6 b3 r
  20. * kind, whether express or implied; without even the implied warranty
    ( S1 a. K. H1 u3 y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / y5 f, Z. o1 X4 x  t
  22. * GNU General Public License for more details.
    8 S( M  v# K# F  [0 W* H1 |
  23. */
    9 m' {0 \. q, H' F: A
  24. 7 m- M1 ^" x/ r0 O
  25. #include <linux/module.h>6 i( j7 f+ P* x* b6 W# ?* M* ^
  26. #include <linux/init.h>* b( e, c9 Y2 N' p: h
  27. #include <linux/errno.h>
    6 c8 H# Z  U7 A/ i: U+ k6 C
  28. #include <linux/types.h>- @0 `6 b  m5 ]& v; n
  29. #include <linux/interrupt.h>
    9 N7 s4 I9 t* h2 R& h
  30. #include <asm/io.h>
    - Z! j# ]" ?% z$ s$ P5 f* B( D
  31. #include <linux/moduleparam.h>. W2 P& E( r7 {* p3 B$ Z, T8 _
  32. #include <linux/sysctl.h>: u6 X) y) [0 T. g5 o
  33. #include <linux/mm.h>
    $ }& A5 ]" W# ^" o
  34. #include <linux/dma-mapping.h>
    2 w$ e: Q9 q! |5 m/ R

  35. % X- u5 M  Z- d2 G* Q
  36. #include <mach/memory.h>2 `7 U2 i* a: k2 t
  37. #include <mach/hardware.h>' v6 u: y! ~5 m4 Q# B
  38. #include <mach/irqs.h>% _# l1 d8 R# }% e
  39. #include <asm/hardware/edma.h>! |. d9 R, ~5 V& T7 v" _3 E

  40. , W* @# u" l& N& g3 t6 m, S5 V0 [
  41. #undef EDMA3_DEBUG
    1 T: m3 N/ |% d) ^( g
  42. /*#define EDMA3_DEBUG*/
    4 C. Z9 i1 F1 {# g/ t# i
  43. + X) o9 Q' G5 R% d6 s) {
  44. #ifdef EDMA3_DEBUG$ T+ |8 v4 u! e+ G- M' r0 M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 U: d5 |0 E6 U! f% n3 a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * i* G; f4 w3 Q& y7 x" \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 X  Z) E0 W" }# g% T* {* a' O7 w
  48. #else
    + O: m2 k! ]+ x! n9 H
  49. #define DMA_PRINTK( x... )" Q; L' g. S1 m% ]) W
  50. #define DMA_FN_IN! u, r0 [' L8 F
  51. #define DMA_FN_OUT
    . x% ?8 p; j" v+ q
  52. #endif0 [% p1 X- u6 l- a) r
  53. # r" z, n& X9 ?; {0 Z( R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 \! B: K. U( Y. ]  _# j
  55. #define STATIC_SHIFT                3( W' Y6 \8 S- X5 f
  56. #define TCINTEN_SHIFT               20
    / b& a: _$ g& H* q  }
  57. #define ITCINTEN_SHIFT              21
    8 w7 i9 v0 ?  A. Y
  58. #define TCCHEN_SHIFT                22! W, |" I! f( X3 \0 z7 {$ o
  59. #define ITCCHEN_SHIFT               23% B+ d, ~- E; r: z
  60. 2 v2 m+ H+ f) Z# q2 D; V
  61. static volatile int irqraised1 = 0;
    " ~5 P& b+ [. x7 Q
  62. static volatile int irqraised2 = 0;  q0 o9 c( v3 C% Z) P' M
  63. 4 C- E4 V% ]' |- s3 C0 j3 `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  L1 Y( x3 R- O: J$ f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' A4 L" r/ a& s: P. R! _1 o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 b, K% @( Y- p( |0 o& K

  67. ! N( d5 J; l5 ]$ @* m( r8 s
  68. dma_addr_t dmaphyssrc1 = 0;( w! X& u8 S; l8 c3 q3 Y
  69. dma_addr_t dmaphyssrc2 = 0;
    ( k0 |5 e! a: _/ }- i+ o7 g1 e
  70. dma_addr_t dmaphysdest1 = 0;" F* b" h0 ^6 E' ?" O& y9 Q2 f! t
  71. dma_addr_t dmaphysdest2 = 0;
    ) H/ I) V+ W7 Q% u

  72. . }* E; z  L$ U: d
  73. char *dmabufsrc1 = NULL;) y0 x  X2 W+ d' R4 i+ i
  74. char *dmabufsrc2 = NULL;" ~/ `5 X% G! }6 S- X$ n; c4 T* ^
  75. char *dmabufdest1 = NULL;
    0 K9 O# Z" |, ]% J
  76. char *dmabufdest2 = NULL;
      q8 G) k  U6 J

  77. , P% D. a7 `4 H: ~+ Z$ b8 c
  78. static int acnt = 512;
    $ J1 H, a) P9 P- ^
  79. static int bcnt = 8;
    3 x7 z2 [: [: _, A& w7 d( f+ |5 d
  80. static int ccnt = 8;( R/ d" S- J3 |: {1 F

  81. 0 C2 D* ?2 W& g% j6 g5 B
  82. module_param(acnt, int, S_IRUGO);$ ]( I* U* h% P" m$ V! ^; x
  83. module_param(bcnt, int, S_IRUGO);# \! f/ H* ^0 X; j8 O; o9 Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' Z5 p/ b' U" C+ Z" h3 h3 [
5 M8 x9 v0 J7 f3 I* I& I# f
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) m. K4 k* A7 E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 Q8 J1 u" x7 b1 m
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* ^$ ]$ H" U; g
, G3 P+ n$ M+ C9 A( J( y
' \1 b* ]& Q1 Y- E2 m* \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-30 02:41 , Processed in 0.043686 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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