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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 Z1 s* Z9 Q2 J
  1. [code]EDMA sample test application
    ! X4 C3 p% t/ k6 y
  2. /*
    4 e& B' i; S: `% P. S
  3. * edma_test.c
    ! x* B+ m  g/ G; b3 r: p% d
  4. *: @% p' z3 t2 S5 t2 }' p1 b5 y
  5. * brief  EDMA3 Test Application8 H7 |. a6 ]& b8 `5 P) Z! n; @* E
  6. *3 Z) b' _$ \2 j, o- m3 n1 l% v' d
  7. *   This file contains EDMA3 Test code." }6 a  v. [1 Y2 N
  8. *
    4 p2 a5 k' M! y! B) T, h; u" S0 [% t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - s0 _! o9 ?8 E' ^  [1 x7 J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / M7 K* U) m, ?0 r5 ?6 y, H- ^( V
  11. *         TO CHANGE.( E7 M% I- O( k& _" y
  12. *8 {9 W( H2 z, I: _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ Q5 h" L# _7 M1 ?
  14. *
    1 E9 A2 H; u' C5 `2 S
  15. * This program is free software; you can redistribute it and/or. l4 p3 c; X# u/ Z/ k0 P
  16. * modify it under the terms of the GNU General Public License as
    & G) h& A9 ^3 ?
  17. * published by the Free Software Foundation version 2.
    + d& b( l3 r& k
  18. *: ^! J1 j( H; _' B% M0 c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 l1 ?& G1 `3 Y% X+ [/ y2 L  C$ t
  20. * kind, whether express or implied; without even the implied warranty& c0 K5 |0 {  [. T: S3 I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " h& f5 S# E; J* ~0 P# O
  22. * GNU General Public License for more details.0 y) R- n  C  o% q
  23. */& _: n2 e0 V3 b+ D" Z" c
  24. ! E& g+ E) i* W) i: F& z
  25. #include <linux/module.h>
    0 r/ z0 D8 q/ ?/ Q: T
  26. #include <linux/init.h>
    ; z$ n2 C/ ]4 w
  27. #include <linux/errno.h>+ h+ ~* t8 K4 ^! l6 b% G" g5 {
  28. #include <linux/types.h>. T( W3 g6 u' }- y
  29. #include <linux/interrupt.h>8 P9 A8 p, G0 i- J* l" t9 S+ y
  30. #include <asm/io.h>
    2 k0 v4 c+ r- i. A6 p
  31. #include <linux/moduleparam.h>
    * R4 B; \% g$ C! O
  32. #include <linux/sysctl.h>
    9 j, o9 ?- D# j9 s( P$ w( y
  33. #include <linux/mm.h>* v. v. o4 K2 g! k6 J" S9 }
  34. #include <linux/dma-mapping.h>. u3 l7 q& B' O; ]+ I' s: T
  35. , z4 v& Z- I1 T" }5 E
  36. #include <mach/memory.h>
    , \, J, q3 p$ M. F
  37. #include <mach/hardware.h>) @- p- b5 O  D1 }" ?  p
  38. #include <mach/irqs.h>( d; P+ I# C+ X8 E# V& T  ~4 ]+ T5 e3 z
  39. #include <asm/hardware/edma.h>* @* c0 F% L$ y$ ^& Y2 b9 I# X- n

  40. " E1 V+ |: `4 t; e3 a6 y) |% J
  41. #undef EDMA3_DEBUG
    - J8 w4 x) q5 p3 b
  42. /*#define EDMA3_DEBUG*/
    0 u7 Q) J" n" E8 l0 l  L. q

  43. ; O5 g3 L- S, P/ r
  44. #ifdef EDMA3_DEBUG4 o- e9 }5 r' P1 c6 h* g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! }2 y4 m7 C7 Z! b( Q4 ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 u8 x3 D( j) C. Q& k& @! J4 V1 S0 W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! A3 c: s, t8 e+ q$ M
  48. #else% o- f7 F1 e# r& F* ^
  49. #define DMA_PRINTK( x... )+ C- K5 n6 z7 z; [
  50. #define DMA_FN_IN
    + f. K) a9 O( e! W
  51. #define DMA_FN_OUT
    1 d( D7 l- ^! u- k. J/ E9 D+ ^
  52. #endif( `/ E9 R% ~/ b2 O( ~5 m8 V+ z; a5 |0 X
  53. ( T, P$ A4 x- T0 t* z. d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 V8 ]0 a. V+ P" K
  55. #define STATIC_SHIFT                36 r5 F5 r3 x! {% q4 u- m. x
  56. #define TCINTEN_SHIFT               20: v) G( ]7 m& h0 p
  57. #define ITCINTEN_SHIFT              21
    : g, N1 t; A  X. J, _
  58. #define TCCHEN_SHIFT                22
    / o. |, X2 x1 u+ c. U& D
  59. #define ITCCHEN_SHIFT               23
    6 t2 I3 C2 p/ A' S  H
  60. - X9 W# i( }$ A0 }3 J- F, d, d, L
  61. static volatile int irqraised1 = 0;
    ! x% M4 c# E% q! s0 c
  62. static volatile int irqraised2 = 0;( L7 l. O- k1 ?8 T, z# n! ]3 C
  63. 9 g4 W, y! X2 y5 A7 ]# d$ @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 ]# g" R& ?9 B+ i( i/ ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 {/ T9 r! i; `) `& G  G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 p8 u/ e2 P' ]7 ~. R3 ?
  67.   |+ t' T' K# ]) ?% ~2 v, T
  68. dma_addr_t dmaphyssrc1 = 0;
    " _* H2 o# t+ B, K  ?5 l( s6 c
  69. dma_addr_t dmaphyssrc2 = 0;
    / |6 z3 A# A8 ]8 ?
  70. dma_addr_t dmaphysdest1 = 0;8 ^! J# U$ ^! ^5 O7 p* P
  71. dma_addr_t dmaphysdest2 = 0;
      z. g3 h& w* }7 D& d% c
  72. / Q! f9 Q' k- T8 O7 l
  73. char *dmabufsrc1 = NULL;/ |  v! c, Y, o
  74. char *dmabufsrc2 = NULL;
    # [* L6 V$ N% `- [. q
  75. char *dmabufdest1 = NULL;9 F: w0 ~8 [# n7 D% a) G2 C3 G; L
  76. char *dmabufdest2 = NULL;
    # d- u+ K$ [; w2 }: r2 A
  77. * }! a; a  m6 g
  78. static int acnt = 512;
    , n; O$ ^* K6 }, g" l# e$ s
  79. static int bcnt = 8;
    8 w) H- m) i' P4 V
  80. static int ccnt = 8;
    9 n, p, f( O$ F) K: C7 d4 y
  81. $ {8 P7 ^1 }1 n& `6 w. F# `
  82. module_param(acnt, int, S_IRUGO);/ C5 D* Z0 [" O  w; ^  n3 X
  83. module_param(bcnt, int, S_IRUGO);
    % y* _' t6 B/ P& g
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# h- S: C; S7 G8 ?: s$ {3 ?

- K, c3 `7 ]5 m. O& D2 i      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( k* B% q( e1 c% }* Z, a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 p% a1 m) W5 g& _: l3 F7 O: y9 ?% D     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" |) W. p4 d! g
: T4 ^3 @2 G) x+ R1 f: L
% g9 Z2 Z! r0 L, ~0 |. K: l7 j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 00:50 , Processed in 0.039701 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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