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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . F- ?* y3 p* L" @/ O0 l6 V+ K
  1. [code]EDMA sample test application7 ^% U- M5 \( y5 m' Z* ~
  2. /*8 Q3 c% S7 n& ^
  3. * edma_test.c
    ) ^2 j0 ~# v/ G) Z8 J) y8 k) m
  4. *
    8 R' [, _# U; m- h
  5. * brief  EDMA3 Test Application( o7 H  ?9 Q, w& o' l4 {8 P
  6. *
    0 Y+ ?" j  w) F+ r/ m
  7. *   This file contains EDMA3 Test code.7 z+ X" D4 O9 N4 o+ U8 K  N
  8. *
    6 l8 q. c. D: V* p( ]6 \: n; ]! F) V( \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' u# i# [& Q- a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- K% \& i& ^' ?5 j; |
  11. *         TO CHANGE.
    6 y% ~. K% d. y0 \3 a
  12. *0 E. A$ ~' D; @& C8 r/ O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 Z5 Q3 L- r) A( H) T$ ?1 d! t
  14. *
    / v8 m* s% p; h4 u: [# Z
  15. * This program is free software; you can redistribute it and/or7 B( b# h- V) C( K! C/ [
  16. * modify it under the terms of the GNU General Public License as5 V. K9 {( G) C, p7 [
  17. * published by the Free Software Foundation version 2.+ q" _' y& L, t
  18. *
    & w7 b9 Z% J+ b' ?- J* u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 T0 a! c5 F4 N- \' Q6 {4 @
  20. * kind, whether express or implied; without even the implied warranty
    ; O& @4 f1 g; u% v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ f  ^( g5 E! C; d0 H$ n
  22. * GNU General Public License for more details.
    ! F. G+ K! n2 a9 s
  23. */! w" y0 Y1 K" t* ]$ ^% c) q

  24. ! y. p) r! _+ q% Z1 Q
  25. #include <linux/module.h>
    4 f  Y! {$ N0 r3 q" _9 m  A5 C
  26. #include <linux/init.h>: D% j6 I: ^' b
  27. #include <linux/errno.h>' ?1 V. }" M! l" l8 k0 p: n
  28. #include <linux/types.h>
    5 U- K3 i# d1 i* e  Y$ d
  29. #include <linux/interrupt.h>: ~* i7 {& H3 K" F# [% L) s
  30. #include <asm/io.h>: p8 x- E* r8 ?+ G, a7 Q
  31. #include <linux/moduleparam.h>, J" l3 `4 y2 D# }  ~( L( y
  32. #include <linux/sysctl.h>$ N3 c$ d$ G" q; ~
  33. #include <linux/mm.h>: H6 [# F  ]5 i6 H3 z
  34. #include <linux/dma-mapping.h>
    % \4 N# \; W$ E# S: ?& w7 p8 O3 m
  35. ) f; Y" R2 L8 a8 N5 U  w
  36. #include <mach/memory.h>
    ( Z) N) D1 x! U8 \6 X
  37. #include <mach/hardware.h>+ S, t2 e$ G# a# V3 T7 g+ e" ]
  38. #include <mach/irqs.h>* U8 [$ D; b+ V! m5 b2 D9 V
  39. #include <asm/hardware/edma.h>
    " O# d8 L3 B6 A+ f9 ]; K8 @
  40. & w' Y" b6 x6 [
  41. #undef EDMA3_DEBUG, V. c( G( }* c
  42. /*#define EDMA3_DEBUG*/0 p) B4 |. V& c7 p- ~
  43. ( d, I$ L) o& G5 L3 A0 Z4 G
  44. #ifdef EDMA3_DEBUG
    5 f$ \, W5 x9 E& D2 X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 R6 r$ M: P+ T* S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* P: h' g% M! F1 |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); o& S/ s9 N; J# p9 f9 z
  48. #else# e* w$ Q' y7 l" d
  49. #define DMA_PRINTK( x... )( |/ t/ J4 s' u/ {: y: j7 Y/ V; }. a! R
  50. #define DMA_FN_IN
    4 q( `2 L; m7 T. C& a
  51. #define DMA_FN_OUT+ Q: x& X) b4 b+ b
  52. #endif4 P* ?- v' J& b- g7 o+ I" P2 R% F0 ]
  53. + _  l; y: q1 C5 o( o0 {" c; o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 W% w1 D5 A% I
  55. #define STATIC_SHIFT                3
    * G; g: T5 y6 H; \5 V: c3 V' g+ p
  56. #define TCINTEN_SHIFT               20
    $ O2 U. N; Q8 c5 u9 H0 T
  57. #define ITCINTEN_SHIFT              21
    2 N6 A/ w) r0 v# y
  58. #define TCCHEN_SHIFT                22
    ' y, ?, u& x6 A# n4 }+ Q
  59. #define ITCCHEN_SHIFT               23% }. b: v+ s. R8 X

  60. 5 I  G" z) B1 u* H
  61. static volatile int irqraised1 = 0;8 x: J  V$ ?, \+ y9 q/ B% Y# G% Z0 W  V* S
  62. static volatile int irqraised2 = 0;
    ) k" t- P. g. ^! _% Q3 z3 ?
  63. , ~- p9 o0 K$ Z# s9 |" n, U* s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - I' ^. F+ F8 y+ m, e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 M. `) x& `  n; j) L0 t- {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* |$ D" Y5 _0 j: j* U
  67. ! E- W/ |+ N8 X/ F  i$ d: P2 r
  68. dma_addr_t dmaphyssrc1 = 0;
    4 z! f- \0 u, Q0 \5 A
  69. dma_addr_t dmaphyssrc2 = 0;
    1 D" H) V. z+ N" C, |8 x) I
  70. dma_addr_t dmaphysdest1 = 0;, ?! Y, ]" p: x) `
  71. dma_addr_t dmaphysdest2 = 0;. b% \2 q. f& n1 U: o: w& @+ E* Z  ^6 ?
  72. ' M% ^& t# o3 Z* k4 z# {
  73. char *dmabufsrc1 = NULL;3 k6 g1 ^  n8 L4 s( |9 K5 u; Y$ d
  74. char *dmabufsrc2 = NULL;
    ! b" D# H9 x9 c
  75. char *dmabufdest1 = NULL;
    ( g- t( D* Z, R) [; c- d4 H# c% G
  76. char *dmabufdest2 = NULL;
    / G$ _; M1 k* j- B( u* r" X

  77. ; N$ ?+ V, W1 c1 ]2 Z6 B- n
  78. static int acnt = 512;
    2 J4 V7 B3 F$ n1 ^% R7 N0 u2 t
  79. static int bcnt = 8;
    6 f! t+ F9 m  e, n0 w. E
  80. static int ccnt = 8;" y5 l" u+ @7 V, A" b; q* V
  81. $ }- u) S/ T# S& U. C# Z9 A6 ~
  82. module_param(acnt, int, S_IRUGO);1 o+ \8 E* m& m
  83. module_param(bcnt, int, S_IRUGO);) b& C; z$ d- Z; G6 J7 b# J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 W' T+ a8 Z9 e% t! m1 U. H1 W
; `- O  a: c3 G# T6 [6 N      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ [6 u7 x! I! Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 S4 G0 q2 I# |% I. U* {$ G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, U& M: ^8 L3 ^0 U5 \  G% P1 f8 [* F
$ P, H0 q  l( `6 k- P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-28 02:29 , Processed in 0.043032 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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