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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 @  R) [. t# D. m" i, N2 \, H
  1. [code]EDMA sample test application
    , W3 m0 G6 H6 w! S. J* v
  2. /*
    2 B: i6 r9 m0 P6 J2 n# A
  3. * edma_test.c# z% P: u' a* \
  4. *) h1 P/ ?3 M0 K6 n- ^! E# V4 j9 S
  5. * brief  EDMA3 Test Application
    2 S2 m+ g0 o% S' |6 Q# Z
  6. *7 b2 Y( \: v1 G. m
  7. *   This file contains EDMA3 Test code.
    0 p/ K8 \$ o3 U8 G5 N
  8. *9 m- V* p2 _3 m6 X/ c7 V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 J5 ]; [$ Y6 b2 i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ v, r) ?/ C- Z$ `
  11. *         TO CHANGE.
    2 l6 c  l4 y8 d+ _9 ~
  12. *2 D0 P# r8 a! S! |  k# K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 a& r# r6 \' P$ Q8 q
  14. *$ P1 y2 B9 V+ F1 }7 ?
  15. * This program is free software; you can redistribute it and/or' @) D- C( F! U& V) O
  16. * modify it under the terms of the GNU General Public License as/ N: w% ~  F0 E. l- Q5 Q4 D% D+ d
  17. * published by the Free Software Foundation version 2.* x) \$ G) R7 t7 P
  18. *
    , j8 @( x' C( C* e- X1 p, w, P& i* O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ n' H- b0 A: c3 D3 F7 S
  20. * kind, whether express or implied; without even the implied warranty
    2 ~1 o8 X6 w/ S0 C  G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. ~* z; i+ I2 g- n" y* {
  22. * GNU General Public License for more details.9 ^$ n; R) V0 \( l
  23. */0 j7 v, t- j4 ~# }, D) g

  24. % Q! p7 |3 ]# A% E5 I) ~
  25. #include <linux/module.h>1 @; R4 z( H- R3 t
  26. #include <linux/init.h>- e% {$ a& ~. R. B+ p$ P3 r9 N
  27. #include <linux/errno.h>
    9 t: _4 c. L; |
  28. #include <linux/types.h>
    3 M" ~7 H, s6 \: ~
  29. #include <linux/interrupt.h>9 d8 A1 ]$ h5 q0 n- v- s
  30. #include <asm/io.h>: ]6 _4 b& r  `
  31. #include <linux/moduleparam.h>* x, k5 l5 q. j" i* v
  32. #include <linux/sysctl.h>
    $ y6 K5 s; E* V0 b5 ^
  33. #include <linux/mm.h>
    1 p0 m5 o" }' j
  34. #include <linux/dma-mapping.h>
    8 O5 ?  ~" H7 B3 l9 s" u8 j2 e

  35. 9 X! q2 z5 U- k. x6 M
  36. #include <mach/memory.h>
    ! O. k; V" Q* o2 w3 N6 c; A8 E
  37. #include <mach/hardware.h>0 K, L- M; v$ k- E/ S* D, M/ |5 Y: e
  38. #include <mach/irqs.h>$ B' ~0 o9 ~8 z- B. c
  39. #include <asm/hardware/edma.h>* A9 y/ i0 |5 G- C% b

  40. 7 O9 \# p( e# H, ?/ e
  41. #undef EDMA3_DEBUG
    9 C# {' c" ?' ], ~: b: w5 j
  42. /*#define EDMA3_DEBUG*/
    ( p# A. c/ z3 S

  43. - @; E4 I# M7 H2 e1 Y
  44. #ifdef EDMA3_DEBUG
    & O2 r* i6 }0 k6 v4 L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ c0 T' h* C8 r4 Y3 ?  W0 p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 ?0 q" m( i) Z5 L. {, G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 }  {  Y6 f& l/ _
  48. #else
    + j9 [' e& K0 j' [
  49. #define DMA_PRINTK( x... )- z) K( b2 h& ^/ D
  50. #define DMA_FN_IN3 A& a9 t' w8 p5 N
  51. #define DMA_FN_OUT, i$ w9 z1 {3 ~: n% v" {( ~
  52. #endif+ a! ~7 O' F8 ^* i" E& {8 ?$ O" ^+ V
  53. ; y4 b7 w& _+ o, l7 b5 A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + O: A; Z3 a& H+ p0 u. V- C
  55. #define STATIC_SHIFT                3
    9 F4 Y7 ~  Q- E+ b3 [1 |6 \
  56. #define TCINTEN_SHIFT               208 _- H: H! o5 w, w0 x8 F0 S+ {
  57. #define ITCINTEN_SHIFT              216 |: m# v9 e7 D0 g
  58. #define TCCHEN_SHIFT                22
    , M- s$ c2 D- o" @' A
  59. #define ITCCHEN_SHIFT               23
    + d3 b4 S$ k6 n7 H, t
  60. + `( Z' G4 o! p8 i
  61. static volatile int irqraised1 = 0;: v& r. h9 u3 f: e6 g
  62. static volatile int irqraised2 = 0;4 C+ G+ K2 ~) L% _
  63. & \  o9 l* x1 q# D- `) Z2 A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ i5 v4 ~, H8 C. ^. k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " ]% _2 u- J7 o3 x  ^$ {7 M' z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ g- c2 \$ x) S" v  q5 [
  67. * L! o; L' ^' X; b' z, t( l
  68. dma_addr_t dmaphyssrc1 = 0;
    / ^: O; J" V5 G$ n( X7 M
  69. dma_addr_t dmaphyssrc2 = 0;
    ) ^7 W0 {4 B3 j1 ~( D
  70. dma_addr_t dmaphysdest1 = 0;1 L6 n% T# u1 h) c8 I0 z, Y% [6 h
  71. dma_addr_t dmaphysdest2 = 0;
    ! u/ A7 K4 W9 a" n4 |" W! P; l7 t+ y

  72. * F0 Y& |$ s4 _) Y' L+ w
  73. char *dmabufsrc1 = NULL;
    7 R" C' V/ J/ g; a
  74. char *dmabufsrc2 = NULL;
    ; o3 l! T  `7 C; `9 U
  75. char *dmabufdest1 = NULL;
    % e! H/ H+ f$ G% s5 A8 Y5 `0 U
  76. char *dmabufdest2 = NULL;. D! h9 \# H( @5 c: }, x4 R+ U/ k) F

  77. 0 I; N8 u' D1 }) L  ?; ^
  78. static int acnt = 512;
    # B; P, h3 N, x9 B5 V
  79. static int bcnt = 8;8 [# A: r( ?, R+ A2 J+ b' ~; H( j% `
  80. static int ccnt = 8;: R: _. Y& d  v, T8 Q" g

  81. - V& h; \, r: b1 a) Y5 l
  82. module_param(acnt, int, S_IRUGO);
    - m0 A$ n$ l/ E; b8 g, ^
  83. module_param(bcnt, int, S_IRUGO);5 P) i! {: h7 V+ c1 I# V
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- {1 L# `; r' \

2 P2 l8 \" W! Z2 Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ j" w9 G1 v- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 v- Z1 e- q2 H* _, _9 z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' H8 g  C, M1 K

& F* n% \( N' V7 p2 p( t7 R4 A6 E+ ^3 z6 G, C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 20:32 , Processed in 0.039720 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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