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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ t& F% C5 X2 Y6 U" n8 V; n& x
  1. [code]EDMA sample test application1 i" s' O) n7 K! l3 s0 ^
  2. /*
    7 l  m$ |" F: t* x: X! {; N1 M
  3. * edma_test.c8 O3 Z% X9 }6 k# `. ]% Z5 E: m
  4. *
    ; u; A& T" q: e4 c, ?
  5. * brief  EDMA3 Test Application
    , P1 h) w" O5 X4 v3 j1 `' y" Q
  6. *
    9 q: d' ]( _1 w1 `  j' @/ m. T. T6 ?
  7. *   This file contains EDMA3 Test code.
    0 P, T5 J: n' f" b
  8. *3 Q6 P' P, `5 X2 e1 t7 O8 z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' K# \) c3 N1 }! _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 Q; d$ e3 @- P; W) Q
  11. *         TO CHANGE.
    & B+ R* ~  b5 I1 }" _* k
  12. *
    ; W6 u. \% I. X& g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) M0 t* N$ t( q1 m& p
  14. *
    , y) m# e' u$ v0 W& w" ?
  15. * This program is free software; you can redistribute it and/or5 o4 G8 F+ ^+ l( v+ b& h
  16. * modify it under the terms of the GNU General Public License as' T# I  ?3 [4 o2 b+ S, S
  17. * published by the Free Software Foundation version 2.  B1 G% a! \2 R4 t1 ^6 a  v
  18. *
    % y/ P  n4 D$ G# b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / X) ?% S2 z4 V% }( ]. a6 y' w
  20. * kind, whether express or implied; without even the implied warranty+ a" {) B  n0 B) w; Y! Y9 [& Y  ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ M+ |% K2 x) D" k( ?
  22. * GNU General Public License for more details.
    : Y# }& Y9 B- Z/ I, k) o8 c
  23. */  x5 t2 e8 m0 k  ?

  24. # W0 f0 Y; H! O) d
  25. #include <linux/module.h>7 d; s: z$ p; x$ k$ z
  26. #include <linux/init.h>
    0 A: P8 d3 b6 c* s& P+ m
  27. #include <linux/errno.h>
    2 a; T  B4 y3 L0 x/ }
  28. #include <linux/types.h>
    ' d$ ~# h# z6 d, ]; l8 G0 {
  29. #include <linux/interrupt.h>; z, Z' V) c/ s# _8 E$ z
  30. #include <asm/io.h>
    8 t2 [. T% `" K2 Q9 m' M# r
  31. #include <linux/moduleparam.h>
    . C8 e' N: ~& v1 O" J& S
  32. #include <linux/sysctl.h>
    7 \0 R+ `) u! u! }
  33. #include <linux/mm.h>- _3 W1 r" S" g; @9 {1 ]
  34. #include <linux/dma-mapping.h>
    ( ~: m* v$ G, u( O: J) O
  35. ) B( E! X6 H% W8 Q
  36. #include <mach/memory.h>
    2 p3 q3 R# e2 z
  37. #include <mach/hardware.h>
    - t8 t+ Z" N5 r* N* `, w. I
  38. #include <mach/irqs.h>, }7 [* K- `7 e+ c! ]
  39. #include <asm/hardware/edma.h>
    9 y. A3 I4 q' Z5 }. Y

  40.   P4 {' i" d% t) t9 ]5 u- G
  41. #undef EDMA3_DEBUG" u( }. Q1 D+ ^8 l- S1 Q0 d' U
  42. /*#define EDMA3_DEBUG*/5 Z4 W- W# C  e5 a! J$ n7 Q
  43. ( }9 f, y) e3 x7 G. x9 y: a% |
  44. #ifdef EDMA3_DEBUG
    , X/ w4 T1 }$ q4 [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ D: V7 Z  ]9 ]8 v' x$ Q. K; X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , l/ b# I& f7 m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& u1 ?/ s' D1 b6 {
  48. #else
    ; o! ~! H* V: |6 v8 l# G7 w8 Y# l
  49. #define DMA_PRINTK( x... )8 \$ ~' Z2 Q3 Q4 p2 E, s, U
  50. #define DMA_FN_IN5 _9 B: o) S, D% T
  51. #define DMA_FN_OUT+ f* N$ B# N! Y6 }& [( C
  52. #endif
    & g! C! s' B% b$ g
  53. 2 j; B* H: |, W  z+ [1 e- Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# R2 w* m1 @  y+ ?& ^
  55. #define STATIC_SHIFT                3
    7 b8 u* q( P5 Z$ V; \* Q, f7 v8 A5 ?
  56. #define TCINTEN_SHIFT               20
    * w$ ?, i7 O; r7 L& V' s3 ~
  57. #define ITCINTEN_SHIFT              21( D: g7 ]7 {2 Y6 [$ A0 H7 y
  58. #define TCCHEN_SHIFT                224 o8 T* j; \1 f2 f* v6 [6 t6 C
  59. #define ITCCHEN_SHIFT               23
    ' f3 n3 E. V" d- M. ~
  60. . H  U7 T& D; |
  61. static volatile int irqraised1 = 0;
    & K8 A, ^- M2 M5 I3 _) u! H
  62. static volatile int irqraised2 = 0;* p* v7 t* x6 t+ j+ F- [* o

  63. 7 u9 z* `1 Z6 d9 T) c! V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . _& A- O7 z2 Y+ H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' k8 k# Z$ f) f% \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / }' P1 E2 |4 b' Z  ]5 A) E* E: P
  67. ) b8 D% L6 u5 D3 b. J# A. S( @
  68. dma_addr_t dmaphyssrc1 = 0;! C# x' e- K) ~0 a: s% Y4 i
  69. dma_addr_t dmaphyssrc2 = 0;. ]; i& k7 A8 r1 q
  70. dma_addr_t dmaphysdest1 = 0;* K: ]' f' z) w* V) d! ?1 f; [0 o
  71. dma_addr_t dmaphysdest2 = 0;1 Z: N3 D5 q' E4 o7 {; Q. H1 ^
  72. , Q9 D8 b4 `, i9 h, C
  73. char *dmabufsrc1 = NULL;' w1 v. G9 |2 Z, b
  74. char *dmabufsrc2 = NULL;' I7 ?" k! v; R# {/ T
  75. char *dmabufdest1 = NULL;& L- b8 ~' y2 ^
  76. char *dmabufdest2 = NULL;
    " W/ a8 ~7 f* @7 T7 W  M* x) K

  77. 4 D0 U1 u0 U. v9 g2 }' z' v6 ~
  78. static int acnt = 512;7 E9 y; h0 {- y! B7 T
  79. static int bcnt = 8;
    0 T! i' C3 @( r' c- @2 o7 F
  80. static int ccnt = 8;
    6 i; V% ~( ^; }" G6 e/ j% }9 \5 r
  81. - g/ T' b3 v8 @" w- n
  82. module_param(acnt, int, S_IRUGO);# [7 N& k4 N6 \* W5 W% d
  83. module_param(bcnt, int, S_IRUGO);
    & T% C0 }% a% u0 G  s. `
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* N% n8 M. a, h" b! ~
. `: Q' T1 g/ J( }& p+ ^! q- n/ j      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ ~) ]1 [) V) f% A2 _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 G0 C$ r  |- N7 `2 _% z* q$ A     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 _% V, H  r. M% p. l+ r# F% }

# q% P8 m+ y5 O( e' _, h
8 \9 O8 r+ B% D% s  Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-25 05:11 , Processed in 0.037705 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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