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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' C6 b8 m6 [# T4 J) ?) H7 F
  1. [code]EDMA sample test application
    ) K3 A8 @! k6 F0 s
  2. /*
    % [  K& K0 n, E8 N& u& {; M
  3. * edma_test.c; N4 }+ ~& j+ W$ ?6 Q4 ^- ~. j( X! q
  4. *' ?3 ?( C9 l" P( j  B6 \
  5. * brief  EDMA3 Test Application
    ' Q% Y" t% E% u; W7 T7 F2 J
  6. */ J5 R" ]) r: T; D" n+ X. P
  7. *   This file contains EDMA3 Test code.: w1 {5 i/ M, L; o  _8 }  k
  8. *
    ) n0 a' H0 Y4 u" P! h, }2 R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ Z9 z, C! ^( z8 ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, ^  y* b5 ?3 u
  11. *         TO CHANGE.4 u3 O* t- J, f" O
  12. *
    * W2 Z1 T' W+ u& S" m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 `! G; s2 j7 c
  14. *
    $ ^$ |; t9 L, X- N9 }& d. I
  15. * This program is free software; you can redistribute it and/or( V0 M) y5 H9 J; y
  16. * modify it under the terms of the GNU General Public License as
    . b" T/ R! ], ^+ k2 `% J
  17. * published by the Free Software Foundation version 2.
      C8 q2 P; C! w6 @0 O
  18. *
    : x% e% E: @, R1 o4 K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ K0 _: t- d6 B% A$ T# n+ K
  20. * kind, whether express or implied; without even the implied warranty
    8 i- |2 d" c9 P6 W# F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! Z4 d7 G) m$ R! j* P
  22. * GNU General Public License for more details.
    7 w$ f7 p# f% ]& G" P% \) U0 Z/ {
  23. */
    % n8 E- w$ J+ E, m# ?3 Y- p
  24. - M0 U, V/ p; s: F0 J9 W7 D* J
  25. #include <linux/module.h>
    7 C' h' f1 ~  A" t  j& G
  26. #include <linux/init.h>' \# }$ c( [( \! k
  27. #include <linux/errno.h>9 U2 }3 D" B) y* N7 ~2 e. r
  28. #include <linux/types.h>( w0 w* |& v+ `# K2 s  h/ Z8 Z
  29. #include <linux/interrupt.h>
      H0 w1 r5 K. c+ B; z% P
  30. #include <asm/io.h>" P" g" z" X7 ]' Z5 ^
  31. #include <linux/moduleparam.h>
    : F) ?% f3 Y5 ~7 s3 Z
  32. #include <linux/sysctl.h>
    ' L) D5 |! g7 G- U5 C/ m/ y% d6 y2 s
  33. #include <linux/mm.h>
    0 X4 t9 v  P& k$ D
  34. #include <linux/dma-mapping.h>  j% y3 h4 ~7 Y3 n' U7 l

  35. 8 x( ?+ A$ I+ _1 p) z" _, a
  36. #include <mach/memory.h>
    1 V- @% {3 a. j) r( d
  37. #include <mach/hardware.h>" y4 k/ j1 C- P/ y# b, v
  38. #include <mach/irqs.h>3 r4 L. ~0 O: L3 Y# y; o8 r
  39. #include <asm/hardware/edma.h>, I4 q/ p3 ~3 _- p4 f" L
  40. : |6 h, t5 w1 I" r; G
  41. #undef EDMA3_DEBUG
    $ d- }, i7 f1 }$ {6 l& P% B* i
  42. /*#define EDMA3_DEBUG*/  t% L+ u; c) j. |
  43. 4 t$ V! R& t7 P0 E; f# C8 m, R0 ^1 y
  44. #ifdef EDMA3_DEBUG, B) f7 Y; c/ d& k" N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 R; b( u4 z# H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * F0 ]( c$ O# ]" W3 W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! s& e6 B& {# v+ {1 [& z
  48. #else
    ( }+ J0 y' H+ T8 Z( E& ~% S% j( v
  49. #define DMA_PRINTK( x... )) V# ]& |  Q6 K5 j- B; o# S7 c: [
  50. #define DMA_FN_IN  A2 g+ D! t2 h4 F# t
  51. #define DMA_FN_OUT# @1 J% w1 R* b/ _
  52. #endif$ ]- }2 @4 y2 f

  53. * y+ s# B5 `2 l4 t1 b) _# i* g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% N- G5 }+ W7 u- h- X
  55. #define STATIC_SHIFT                38 P+ Z! {* C; h7 u) r
  56. #define TCINTEN_SHIFT               208 c# G2 {( q) [2 Q+ P1 s
  57. #define ITCINTEN_SHIFT              21
    , T6 a- k) Z0 g9 _. j5 N  s
  58. #define TCCHEN_SHIFT                22
    ; p: i0 {, c+ y4 d6 r- y
  59. #define ITCCHEN_SHIFT               23  p9 ~& T0 B- `$ ^( u/ S+ D

  60. ! w% z9 Z0 t+ o0 X8 w3 t. ?5 P4 i
  61. static volatile int irqraised1 = 0;
      ^7 S7 w+ }, |$ N
  62. static volatile int irqraised2 = 0;' ?; v! r! ~8 o0 H3 A
  63. % _* k! u- E2 i5 `: {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 `; S: c# M6 w, t! X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & _, H7 E5 n, n1 I! i, n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 @% X; o/ J% F8 N1 W& t# B
  67. , P' O) Q0 _; H8 D
  68. dma_addr_t dmaphyssrc1 = 0;) X2 i& z3 _6 U% l3 q) x0 r! l
  69. dma_addr_t dmaphyssrc2 = 0;! Y& V- Q3 B+ T6 X, L% n, t9 }
  70. dma_addr_t dmaphysdest1 = 0;9 d/ L2 Q7 f6 F# x
  71. dma_addr_t dmaphysdest2 = 0;9 x+ f! p1 M% ~3 B

  72. $ U( T$ W) o( c. c# b
  73. char *dmabufsrc1 = NULL;: R- g( T+ ]! y. T7 U6 a
  74. char *dmabufsrc2 = NULL;
    % y4 d4 `/ D# O5 j# i+ y! a
  75. char *dmabufdest1 = NULL;
    : N$ [$ K1 o3 j* }* E
  76. char *dmabufdest2 = NULL;; t7 M: P6 M! y

  77. 3 }& s( q. b2 d  r& H( Q
  78. static int acnt = 512;' J5 V, {4 w8 `9 i7 V$ o% Y
  79. static int bcnt = 8;' y' `' c4 a  X0 j. q3 y
  80. static int ccnt = 8;
    . I- ^% U* o4 `0 ^
  81. " C0 f& }8 J9 L- x. E
  82. module_param(acnt, int, S_IRUGO);/ [' F! q5 U6 d
  83. module_param(bcnt, int, S_IRUGO);7 s6 c& A+ q  O: p+ x* d+ l
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- P; a; |5 {# V
4 x; Z( H- Z( Y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 j) l3 s9 u9 \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. K( J9 h/ U7 q, f8 k6 z3 d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 ?+ y# c  ]/ n" B7 A" H9 k. h/ C. O4 D: O* _  y" p8 Q) A
& `  b" L, i- m8 m4 T9 u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-23 23:03 , Processed in 0.040335 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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