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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 v* `& t& J* j
  1. [code]EDMA sample test application6 u7 u. o* Q/ c& a$ o  w
  2. /*
    $ j- d5 r0 Z/ s7 T- E, f# o
  3. * edma_test.c
    : J# l! W1 y7 T9 R7 I+ r
  4. */ J" Q1 n: K6 I6 J5 X! {" N) f' F
  5. * brief  EDMA3 Test Application# g' u% @+ |( Q. L7 f( o7 e; m  q
  6. *
    ; j0 i( v1 v; {# B5 ?$ ?2 p
  7. *   This file contains EDMA3 Test code.2 m/ K- u$ V$ H9 d
  8. *
    ( r) w2 g; a6 s* H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 B% M+ b$ t3 r& l$ A" a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 E. U* d: K4 [! X- S
  11. *         TO CHANGE.
    ) K) C6 g; g" O: d' d/ e( E
  12. *0 K9 a8 L/ ^0 j5 t+ h4 A( ~: @! B( Z2 B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 v' u. F! D  M# s% l7 N
  14. *' Y: P* o) W# G: \: ?
  15. * This program is free software; you can redistribute it and/or
    * w* v3 l. \* ?, x/ m1 b
  16. * modify it under the terms of the GNU General Public License as
    . ^# o, m7 G) y# {8 ]9 k+ |/ U
  17. * published by the Free Software Foundation version 2.0 |) L% J( \  B) \3 m0 d" Y6 i
  18. *+ g  j! x7 R1 r- H/ p# A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: @: D* o9 p9 b( C7 L' v* t+ O
  20. * kind, whether express or implied; without even the implied warranty
    2 z9 m0 r( R7 Q' w8 b  a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( e; }5 g: {1 Z
  22. * GNU General Public License for more details.! J1 n- ^* m7 S% z) ^3 Q
  23. */0 [( ]/ p8 n6 o  ]

  24. 0 u, ^6 h2 h0 b
  25. #include <linux/module.h>
    . m3 L# y  ]; r
  26. #include <linux/init.h>
    . C; B! P  y! V4 J# p
  27. #include <linux/errno.h>' H9 }# k7 B% b8 [
  28. #include <linux/types.h>* L& O, q5 K- |( H
  29. #include <linux/interrupt.h>, ?- F7 x; D8 l) _$ T
  30. #include <asm/io.h>
    ) K. K& W4 c& V. _& N
  31. #include <linux/moduleparam.h>
    # V) N2 M6 T. h
  32. #include <linux/sysctl.h>5 `# Z6 P, H8 S# K
  33. #include <linux/mm.h>
    . r# @- d+ J1 ^, N; u
  34. #include <linux/dma-mapping.h>2 D/ C3 G) ^; k. `# g# ?

  35. ; H/ W8 p: O, U: c4 a$ R9 `
  36. #include <mach/memory.h>
    ! ^$ D! b9 A! P1 p
  37. #include <mach/hardware.h># U' l; m( x) a, N
  38. #include <mach/irqs.h>' q4 ^  d+ }% q7 w. F
  39. #include <asm/hardware/edma.h>9 _. Z1 i  R& f+ Y4 p  D

  40. 3 S7 v/ _+ X- |5 a9 B! d) v+ R% c) U
  41. #undef EDMA3_DEBUG
    7 S& Q  T; \% \; }& H4 ~
  42. /*#define EDMA3_DEBUG*/
    : I9 E/ K$ F+ K) v
  43. ; p: E! O5 n' t" Z, a0 B
  44. #ifdef EDMA3_DEBUG
    3 t/ v9 I! f3 {" m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 ?  F$ F( l$ S( b( y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( t- p  c$ b. K3 a7 y/ A/ l# h' J# {1 b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); A4 c" O% h( U& N4 J% R
  48. #else. ~4 A5 {( \$ j' K" j
  49. #define DMA_PRINTK( x... )
    7 U. q0 h$ W$ {% m5 ?* X- A
  50. #define DMA_FN_IN
    4 u. _' h+ `$ e" U3 O
  51. #define DMA_FN_OUT
    4 w/ g7 p8 g( k
  52. #endif
    8 J+ J- h: R7 x' E

  53. / q6 D1 x# ^4 V* e$ \7 [: U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 a1 H$ Y6 W1 {4 q
  55. #define STATIC_SHIFT                34 O5 m: W; W1 A6 j# W3 m
  56. #define TCINTEN_SHIFT               20) a$ T( D9 I, d5 ~, |! h
  57. #define ITCINTEN_SHIFT              219 Q4 ~+ B" _% d: C% S* i
  58. #define TCCHEN_SHIFT                22
    # L( K' `0 f5 ]. j4 b* T3 i' R4 E/ R
  59. #define ITCCHEN_SHIFT               235 I* m4 k6 m+ `  |! }2 P
  60. 5 l# P3 w1 I2 P8 m. Q
  61. static volatile int irqraised1 = 0;: W- G, x# y* Z: }* ]6 j; V' |
  62. static volatile int irqraised2 = 0;
    9 y- D# C8 x% L/ ?* `& u

  63. 3 @6 i+ p% c6 w8 c0 F2 ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ j& ~9 _$ F0 l# b7 }" W+ ?/ K% d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 N/ c# W! l3 G# i% D! ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * k' M: }, C' c% M$ x+ R' i9 l# ]1 x
  67. ! D* B5 E4 U3 ]+ Q7 d0 p9 h
  68. dma_addr_t dmaphyssrc1 = 0;' o& T, i- N- K# T
  69. dma_addr_t dmaphyssrc2 = 0;
    5 t& U# P( ~7 ^3 [0 f. u8 d
  70. dma_addr_t dmaphysdest1 = 0;
    6 k+ g$ B4 j/ ~7 C
  71. dma_addr_t dmaphysdest2 = 0;
    " @( d* S3 K* l! u: z: s3 l: d. q' \- ]
  72. # w) s4 d( {2 }8 i' L4 |
  73. char *dmabufsrc1 = NULL;
    - T  h" O' u- s/ B  n0 ^' C
  74. char *dmabufsrc2 = NULL;( Q! d; p6 }% Y* q% Z
  75. char *dmabufdest1 = NULL;
    : Y2 P+ q* x" `' `& x+ i, L
  76. char *dmabufdest2 = NULL;
    # w2 k9 g- }% O+ i
  77. ( K' K  {' }( k+ ^
  78. static int acnt = 512;5 T" `$ X3 l' V  @
  79. static int bcnt = 8;; b2 m$ {; {5 N" k
  80. static int ccnt = 8;
    * P) F  ?# v/ J) ?2 H) T

  81. 8 D6 e1 ?0 O- @7 R
  82. module_param(acnt, int, S_IRUGO);0 {& r: \5 V+ j6 {8 w0 u
  83. module_param(bcnt, int, S_IRUGO);4 q3 w. J1 \+ u4 J) Y1 ^( w$ z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 G; r; T2 J6 n9 }$ d
# x: x, s2 j3 ]: z- Y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  N# l5 k; a6 s* S- Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 T2 N1 F; F; c3 i& C, X     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ s6 @( E2 M2 B& c4 V
2 U# N2 l0 e1 m, F) ]! v6 r1 C$ ]' y" h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-29 07:39 , Processed in 0.042869 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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